qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Fix definition of NULL


From: M. Warner Losh
Subject: Re: [Qemu-devel] [PATCH] Fix definition of NULL
Date: Fri, 06 Feb 2009 16:25:49 -0700 (MST)

In message: <address@hidden>
            Stefan Weil <address@hidden> writes:
: Hello,
: 
: the definition of NULL in dyngen-exec.h is correct for C++
: but wrong for C. It results in a compiler warning.
: 
: My patch fixes it. Because Qemu does not support C++,
: I just used the C definition and did not try to support
: C++, too.

Actually, it is correct for C as well.  "#define NULL 0" is a
perfectly acceptable definition[*].  Your definition is also correct,
since there are two valid NULL pointer definitions in 'C'.  Which one
you use will determine which class of errors you catch, but neither
one will catch all errors.

which compilers is it generating warnings on and what are the
warnings?

Warner

[*] C9x section 3.2.3 para 3 states:

       [#3] An integer constant expression with  the  value  0,  or
       such  an  expression  cast  to type void *, is called a null
       pointer constant.

with a footnote that says NULL is defined in stddef.h.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]