mercredi 1 mars 2017

C++11 and zero character constants

GCC 7 will be released soon. The GCC 7 release notes states the following under C Family:

-Wpointer-compare warns when a pointer is compared with a zero character constant. Such code is now invalid in C++11 and GCC rejects it. This warning is enabled by default.

I feel like I am missing a nuance to the issue at hand (or worse, something obvious). What are zero character constants? How do they create trouble for C and C++?


Here's a few related C++ questions. The answers have improved over time, and point out things like Stroustrup prefers comparing to 0 and sizeof(int) != sizeof(void*). But they don't discuss the zero character constants.

Aucun commentaire:

Enregistrer un commentaire