Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Use of do...while(0) in ASSERT macro
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Richard Heathfield, post: 1688894"] Yes, precisely. Well, not quite as much whitespace. I'd prefer: if(0 != x) { y(); } That doesn't surprise me, but I must disagree with you. That's a negative description. Here's a positive one to balance: it emphasises the logical structure of the code. No, the macro isn't the problem. People are the problem. They /will/ keep turning this: if(w != x) y(); into this: if(w != x) y(); z(); and then wondering why z() is called more often than they expected. (Utter foolishness, I know.) No, I'm perfectly happy with my bracing style, thanks - even if you disagree with it. There are certain rather obvious uses for macros. (Bit-twiddling is one. Wrapping __FILE__ and __LINE__ is another.) [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Use of do...while(0) in ASSERT macro
Top