This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: do { .... } while 0;


Ah! Silly me !!
Happens sometime :)

Thanks !!

Andrew Haley wrote:
> 
> Try:
> 
> #define FOO(C)                                  \
> {                                               \
>   return C;                                     \
> }
> 
> #define FOO(C)                                  \
> do                                              \
> {                                               \
>   return C;                                     \
> }                                               \
> while (0)
> 
> extern int a, b, c;
> int main ()
> {
>   if (a = b)
>     FOO(c);
>   else
>     return a;
> }
> 
> with both versions of FOO.
> 
> Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]