Quantcast
Channel: lkml.org : Ganesh Sittampalam
Viewing all articles
Browse latest Browse all 627

Re: detecting integer constant expressions in macros

$
0
0
Linus Torvalds writes: (Summary) That might be the right approach, even if I like how it only used standard C (although _disgusting_ standard C) without it apart from the small issue of sizeof(void)
the small issue of sizeof(void)
So something like
So something like
#define __is_constant(a) \
__builtin_types_compatible_p(int *, typeof(1 ? ((void*)((a) * 0l)) : (int*)1 ) )
0l)) : (int*)1 ) )
if I counted the parentheses right..
if I counted the parentheses right..
Linus
Linus
Linus

Viewing all articles
Browse latest Browse all 627

Trending Articles