Quantcast
Channel: lkml.org : Shesha Sreenivasamurthy
Viewing all articles
Browse latest Browse all 1267

Re: detecting integer constant expressions in macros

$
0
0
Linus Torvalds writes: (Summary) ((void*)((x) * 0l)) : (int*)1))) Ok, so I can see that (void *)((x)*0l)) turns into NULL when x is an ICE. NULL : (int *) 1)
sizeof( 1 ? NULL : (int *) 1)
and the rule is that if one of the sides of a ternary operation with pointers is NULL, the end result is the other type (int *). So yes, the above returns 'sizeof(int)'.
So yes, the above returns 'sizeof(int)'.
And if it is *not* an ICE that first pointer is still of type '(void *)', but it is not NULL.
*)', but it is not NULL.
And yes, the type conversion rules for a ternary op with two non-NULL pointers is different, and it now returns "void *".

Viewing all articles
Browse latest Browse all 1267

Trending Articles