From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6756 invoked by alias); 14 Feb 2010 21:47:20 -0000 Received: (qmail 6720 invoked by uid 48); 14 Feb 2010 21:47:08 -0000 Date: Sun, 14 Feb 2010 21:47:00 -0000 Message-ID: <20100214214708.6718.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/35669] NULL (__null) not considered different from 0 with C++ In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "l dot lunak at suse dot cz" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-02/txt/msg01344.txt.bz2 ------- Comment #18 from l dot lunak at suse dot cz 2010-02-14 21:47 ------- (In reply to comment #17) > Which one? We are not going to warn for conversions to boolean and we are not > going to warn for explicit conversions. I don't see anybody asking for that. > And we are not going to warn by default, only with -Wconversion. If you fail to see the difference between NULL being converted to integer being almost always a mistake and the flood of warnings caused by -Wcoversion to be almost almost harmless in real-world code, then you probably might as well not bother at all. A warning about something that's almost for sure a mistake being part of a flag that almost nobody uses is next to useless. > So, please post a testcase as minimal and self-contained (with the smallest > number of includes) as possible and point out > exactly what you expect to happen. Well, it's all in the original comment of this bugreport, but if you insist: Testcase (a.c): #include void foo( int a ); int main() { foo( NULL ); foo( 0 ); int a = NULL; return 0; } Expected output (like 'gcc -Wall -c a.c' provides): a.c: In function ‘main’: a.c:5: warning: passing argument 1 of ‘foo’ makes integer from pointer without a cast a.c:2: note: expected ‘int’ but argument is of type ‘void *’ a.c:7: warning: initialization makes integer from pointer without a cast a.c:7: warning: unused variable ‘a’ Actual output (what 'g++ -Wall -c a.c' provides): a.c: In function ‘int main()’: a.c:7: warning: unused variable ‘a’ The warning about the unused variable is obviously irrelevant. -- l dot lunak at suse dot cz changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |UNCONFIRMED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35669