[patch] Let stddef.h redefine NULL if __need_NULL is set
Lubos Lunak
l.lunak at centrum.cz
Tue Apr 29 07:35:25 PDT 2014
On Monday 28 of April 2014, Reid Kleckner wrote:
> Even if we commit this workaround, can we report this as a bug to upstream
> Linux?
Already done (http://comments.gmane.org/gmane.linux.kernel/1281756). And
there's actually no public #define NULL in recent Linux headers.
> The test case you have shows how this definition of NULL is broken
> on x86_64, even in C with gcc:
>
> $ cat t.c
> #define NULL 0
> int printf(const char *, ...);
> int main() {
> printf("%d %d %d %d %d %d %p\n", 1, 2, 3, 4, 5, 6,
> 0xdeadbeefdeadbeefULL); printf("%d %d %d %d %d %d %p\n", 1, 2, 3, 4, 5, 6,
> NULL);
> }
>
> $ gcc -w t.c -o t && ./t
> 1 2 3 4 5 6 0xdeadbeefdeadbeef
> 1 2 3 4 5 6 0xdeadbeef00000000
--
Lubos Lunak
More information about the cfe-commits
mailing list