Click here to Skip to main content
14,423,253 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralThis is cool. I figured out a neat thing Pin
honey the codewitch14-Dec-19 19:39
mvahoney the codewitch14-Dec-19 19:39 
JokeRe: This is cool. I figured out a neat thing Pin
lopatir14-Dec-19 20:41
Memberlopatir14-Dec-19 20:41 
GeneralRe: This is cool. I figured out a neat thing Pin
Daniel Pfeffer14-Dec-19 23:05
professionalDaniel Pfeffer14-Dec-19 23:05 
GeneralRe: This is cool. I figured out a neat thing Pin
phil.o14-Dec-19 23:27
mvephil.o14-Dec-19 23:27 
GeneralRe: This is cool. I figured out a neat thing Pin
W Balboos15-Dec-19 8:16
mveW Balboos15-Dec-19 8:16 
GeneralRe: This is cool. I figured out a neat thing Pin
phil.o15-Dec-19 8:27
mvephil.o15-Dec-19 8:27 
GeneralRe: This is cool. I figured out a neat thing Pin
honey the codewitch15-Dec-19 8:49
mvahoney the codewitch15-Dec-19 8:49 
GeneralJust because you can doesn't mean you should. Pin
rjmoses14-Dec-19 12:28
professionalrjmoses14-Dec-19 12:28 
Tripping through some older but still used C code, I found this section:

action a;
if ((a = hash_table[r]) && !cmdcmp(commands[--a].name, p)
|| (a = short_hash_table[r]) && !cmdcmp(commands[--a].short_name, p)) r = a;
else r = -1;

Somebody sure put a lot of faith that the order of evaluation, especially short-circuit evaluation, would remain the same across compilers!

Of course, the programmer saved a couple of characters by excluding four(?) unnecessary parens.

Upon further investigation, I found many instances of this type of statement structure. Apparently that was the preferred coding style. So, I'm guessing the programmer probably saved 100 characters. But it takes a lot of time to examine each statement and hopefully understand what is going on.
GeneralRe: Just because you can doesn't mean you should. PinPopular
Rick York14-Dec-19 12:54
mveRick York14-Dec-19 12:54 
GeneralRe: Just because you can doesn't mean you should. Pin
Gary Wheeler16-Dec-19 2:47
MemberGary Wheeler16-Dec-19 2:47 
GeneralRe: Just because you can doesn't mean you should. Pin
PIEBALDconsult14-Dec-19 13:53
professionalPIEBALDconsult14-Dec-19 13:53 
GeneralRe: Just because you can doesn't mean you should. Pin
honey the codewitch14-Dec-19 17:48
mvahoney the codewitch14-Dec-19 17:48 
GeneralRe: Just because you can doesn't mean you should. Pin
PIEBALDconsult14-Dec-19 18:19
professionalPIEBALDconsult14-Dec-19 18:19 
GeneralRe: Just because you can doesn't mean you should. Pin
honey the codewitch14-Dec-19 18:22
mvahoney the codewitch14-Dec-19 18:22 
GeneralRe: Just because you can doesn't mean you should. Pin
Kirk 1038982116-Dec-19 4:29
MemberKirk 1038982116-Dec-19 4:29 
GeneralRe: Just because you can doesn't mean you should. PinPopular
Cp-Coder14-Dec-19 15:05
MemberCp-Coder14-Dec-19 15:05 
GeneralRe: Just because you can doesn't mean you should. Pin
Greg Utas14-Dec-19 15:39
professionalGreg Utas14-Dec-19 15:39 
GeneralRe: Just because you can doesn't mean you should. Pin
Jon McKee14-Dec-19 17:23
professionalJon McKee14-Dec-19 17:23 
GeneralRe: Just because you can doesn't mean you should. Pin
PIEBALDconsult14-Dec-19 18:13
professionalPIEBALDconsult14-Dec-19 18:13 
GeneralRe: Just because you can doesn't mean you should. Pin
Greg Utas15-Dec-19 2:05
professionalGreg Utas15-Dec-19 2:05 
GeneralRe: Just because you can doesn't mean you should. Pin
Jörgen Andersson15-Dec-19 2:22
communityengineerJörgen Andersson15-Dec-19 2:22 
GeneralRe: Just because you can doesn't mean you should. Pin
Gary Wheeler16-Dec-19 2:51
MemberGary Wheeler16-Dec-19 2:51 
GeneralRe: Just because you can doesn't mean you should. Pin
Member 844862216-Dec-19 4:01
MemberMember 844862216-Dec-19 4:01 
GeneralRe: Just because you can doesn't mean you should. Pin
John Wellbelove16-Dec-19 9:53
MemberJohn Wellbelove16-Dec-19 9:53 
GeneralRe: Just because you can doesn't mean you should. Pin
Randor 14-Dec-19 17:31
professional Randor 14-Dec-19 17:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.