do{..}while(0) macro substitutions
From: Yan (rottled_at_gmail.com)
Date: 12/31/04
- Next message: Bonj: "Re: Recommended style"
- Previous message: Bonj: "Re: Recommended style"
- Next in thread: Alexandre: "Re: do{..}while(0) macro substitutions"
- Reply: Alexandre: "Re: do{..}while(0) macro substitutions"
- Reply: Ben Pfaff: "Re: do{..}while(0) macro substitutions"
- Reply: Andrey Tarasevich: "Re: do{..}while(0) macro substitutions"
- Reply: E. Robert Tisdale: "Re: do{..}while(0) macro substitutions"
- Reply: Flash Gordon: "Re: do{..}while(0) macro substitutions"
- Reply: Emmanuel Delahaye: "Re: do{..}while(0) macro substitutions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Dec 2004 23:29:27 GMT
A lot of times when reading open software, i come across macros that are
defined as follows:
#define CALL_FUNCS(x) \
do { \
func1(x); \
func2(x); \
func3(x); \
} while (0);
now, of course this will work but how is this any better than:
#define CALL_FUNCS(x) \
{ \
func1(x); \
func2(x); \
func3(x); \
}
i can't see how the compiler can optimize (a) any better than (b) or in
any case can (b) break what (a) won't. Any input will be appreciated.
tia
- Next message: Bonj: "Re: Recommended style"
- Previous message: Bonj: "Re: Recommended style"
- Next in thread: Alexandre: "Re: do{..}while(0) macro substitutions"
- Reply: Alexandre: "Re: do{..}while(0) macro substitutions"
- Reply: Ben Pfaff: "Re: do{..}while(0) macro substitutions"
- Reply: Andrey Tarasevich: "Re: do{..}while(0) macro substitutions"
- Reply: E. Robert Tisdale: "Re: do{..}while(0) macro substitutions"
- Reply: Flash Gordon: "Re: do{..}while(0) macro substitutions"
- Reply: Emmanuel Delahaye: "Re: do{..}while(0) macro substitutions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|