Click here to Skip to main content
15,891,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 18:39
mvahoney the codewitch14-Dec-19 18:39 
JokeRe: This is cool. I figured out a neat thing Pin
lopatir14-Dec-19 19:41
lopatir14-Dec-19 19:41 
GeneralRe: This is cool. I figured out a neat thing Pin
Daniel Pfeffer14-Dec-19 22:05
professionalDaniel Pfeffer14-Dec-19 22:05 
GeneralRe: This is cool. I figured out a neat thing Pin
phil.o14-Dec-19 22:27
professionalphil.o14-Dec-19 22:27 
GeneralRe: This is cool. I figured out a neat thing Pin
W Balboos, GHB15-Dec-19 7:16
W Balboos, GHB15-Dec-19 7:16 
GeneralRe: This is cool. I figured out a neat thing Pin
phil.o15-Dec-19 7:27
professionalphil.o15-Dec-19 7:27 
GeneralRe: This is cool. I figured out a neat thing Pin
honey the codewitch15-Dec-19 7:49
mvahoney the codewitch15-Dec-19 7:49 
GeneralJust because you can doesn't mean you should. Pin
rjmoses14-Dec-19 11:28
professionalrjmoses14-Dec-19 11: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. Pin
Rick York14-Dec-19 11:54
mveRick York14-Dec-19 11:54 
GeneralRe: Just because you can doesn't mean you should. Pin
Gary Wheeler16-Dec-19 1:47
Gary Wheeler16-Dec-19 1:47 
GeneralRe: Just because you can doesn't mean you should. Pin
PIEBALDconsult14-Dec-19 12:53
mvePIEBALDconsult14-Dec-19 12:53 
GeneralRe: Just because you can doesn't mean you should. Pin
honey the codewitch14-Dec-19 16:48
mvahoney the codewitch14-Dec-19 16:48 
GeneralRe: Just because you can doesn't mean you should. Pin
PIEBALDconsult14-Dec-19 17:19
mvePIEBALDconsult14-Dec-19 17:19 
GeneralRe: Just because you can doesn't mean you should. Pin
honey the codewitch14-Dec-19 17:22
mvahoney the codewitch14-Dec-19 17:22 
GeneralRe: Just because you can doesn't mean you should. Pin
Kirk 1038982116-Dec-19 3:29
Kirk 1038982116-Dec-19 3:29 
GeneralRe: Just because you can doesn't mean you should. PinPopular
Cp-Coder14-Dec-19 14:05
Cp-Coder14-Dec-19 14:05 
GeneralRe: Just because you can doesn't mean you should. Pin
Greg Utas14-Dec-19 14:39
professionalGreg Utas14-Dec-19 14:39 
GeneralRe: Just because you can doesn't mean you should. Pin
Jon McKee14-Dec-19 16:23
professionalJon McKee14-Dec-19 16:23 
GeneralRe: Just because you can doesn't mean you should. Pin
PIEBALDconsult14-Dec-19 17:13
mvePIEBALDconsult14-Dec-19 17:13 
GeneralRe: Just because you can doesn't mean you should. Pin
Greg Utas15-Dec-19 1:05
professionalGreg Utas15-Dec-19 1:05 
GeneralRe: Just because you can doesn't mean you should. Pin
Jörgen Andersson15-Dec-19 1:22
professionalJörgen Andersson15-Dec-19 1:22 
GeneralRe: Just because you can doesn't mean you should. Pin
Gary Wheeler16-Dec-19 1:51
Gary Wheeler16-Dec-19 1:51 
GeneralRe: Just because you can doesn't mean you should. Pin
Member 844862216-Dec-19 3:01
Member 844862216-Dec-19 3:01 
GeneralRe: Just because you can doesn't mean you should. Pin
John Wellbelove16-Dec-19 8:53
John Wellbelove16-Dec-19 8:53 
GeneralRe: Just because you can doesn't mean you should. Pin
Randor 14-Dec-19 16:31
professional Randor 14-Dec-19 16: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.