https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64767
Bug ID: 64767 Summary: Could GCC warn when a pointer is compared against '\0'? Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ulfalizer at gmail dot com This would detect e.g. ptr == '\0' when *ptr == '\0' was intended, which could be very dangerous (and just bit me). This might be tricky to implement in C since '\0' has type int and comparing a pointer against 0 is common. In C++ it has type char, so maybe a warning could be generated for ptr == (char)0 there. Thoughts?