Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Page 3 of 3 < 1 2 3
Topic Options
#267337 - 25/10/2005 03:12 Re: Humor For Programmers [Re: rob]
canuckInOR
carpal tunnel

Registered: 13/02/2002
Posts: 3212
Loc: Portland, OR
Heh. Yeah, I know. I always brace, just because a one-line if/else statement will always turn into a block given enough time. In this case, it's not my code -- just a sufficiently deeply nested example. Although, now that you mention it, I think it is a macro. I think I'll check it out tomorrow...

Top
#267338 - 25/10/2005 08:05 Re: Humor For Programmers [Re: rob]
peter
carpal tunnel

Registered: 13/07/2000
Posts: 4181
Loc: Cambridge, England
Quote:
Code:

...
else
TXT_Printf(stderr, SEV_ERROR, "Unknown error.\n");
exit(result.errorCode);


Tsk, always brace, could be a macro!

Shouldn't matter, if the macro writer knew what they were doing.
Code:
#define TXT_Printf(X,Y...) do { stmt; stmt; stmt; } while (0)


If the macro is defined in such a way that it doesn't act as a single statement, then IMO the definition is at fault, not the lack of braces at the use site.

Peter

Top
#267339 - 25/10/2005 09:55 Re: Humor For Programmers [Re: peter]
rob
carpal tunnel

Registered: 21/05/1999
Posts: 5335
Loc: Cambridge UK
Quote:
Shouldn't matter

Don't make me get religious on your ass now!

Rob

Top
#267340 - 25/10/2005 10:18 Re: Humor For Programmers [Re: rob]
JeffS
carpal tunnel

Registered: 14/01/2002
Posts: 2858
Loc: Atlanta, GA
Quote:
Don't make me get religious on your ass now!
LOL!

FWIW, I'm an "always put the braces" guy, but I'm not "religious" about it toward other programmers.
_________________________
-Jeff
Rome did not create a great empire by having meetings; they did it by killing all those who opposed them.

Top
#267341 - 25/10/2005 12:11 Re: Humor For Programmers [Re: peter]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5683
Loc: London, UK
Quote:
Shouldn't matter, if the macro writer knew what they were doing.


Agreed; I just had to fix up a couple of macros in our codebase here. Not because anyone had used them where they could break, but because they're just Wrong(tm).
_________________________
-- roger

Top
Page 3 of 3 < 1 2 3