zero-as-null-pointer-constant C++ trunk

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

 



Hello

This is a little test case. It is not real code.

We used gcc-8 to get some warnings, but on the godbolt trunk gcc doesn't those warnings with this little test case. Am I missing something obvious? Is this an issue?

with gcc-8 only (1) of the (3) occurrences of NULL is warned.

Cheers, Jonny

myfile.cpp:100:15 error: zero as null pointer constant [-Werror=zero-as-null-pointer-constant]
     if(NULL == format)
                ^~~~~~


Options
-Wall -Wextra -Werror=zero-as-null-pointer-constant



#include <cstddef>

int str(const char * const format, ...)
{
    if(NULL == format)   // gcc-8 warning
    {
        return -1;
    }

    return 0;
}

int main()
{
    char * buf = NULL;

    str(buf);

    return (NULL == buf);
}



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux