compilation error
Lyle Seaman
lws at spinnakernet.com
Tue Oct 10 18:57:47 GMT 2000
Herb Lewis wrote:
> I disagree. If you look at what actually gets generated, you are mixing
> two different types as the results of the conditional operator.
>
> The 0 by default is type int. The DEBUG macro is defined as type (void).
> So you say if x is true make the expression an int but if x is false
> make
> the expression a void. The IRIX compiler forces you to declare both
> operands as the same type. Maybe you could argue that this is too
> restrictive but I wouldn't call it a bug.
>
> Either of the following would be correct (I simplified the macro to
> make it easier to see what is happening printf is decalred an int)
>
> #define SMB_ASSERT(b) ((b)?(void)0: (void)printf(""))
> #define SMB_ASSERT_OK(b) ((b)?0: printf(""))
>
it's comma time.
#define foo (a) ( a ? 0 : printf (""), 0 )
More information about the samba-technical
mailing list