From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8311 invoked by alias); 27 Mar 2012 22:43:26 -0000 Received: (qmail 8287 invoked by uid 22791); 27 Mar 2012 22:43:26 -0000 X-SWARE-Spam-Status: No, hits= required= tests= Received: from newsaf.bio.caltech.edu (HELO newsaf.bio.caltech.edu) (131.215.12.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Mar 2012 22:43:15 +0000 Received: from localhost ([127.0.0.1] helo=saf.bio.caltech.edu) by newsaf.bio.caltech.edu ([127.0.0.1]:25) with esmtp id 1SCf6h-00057V-6o - Using Exim-4.72 (MandrivaLinux) MTA (return-path ); Tue, 27 Mar 2012 15:43:15 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 27 Mar 2012 22:43:00 -0000 From: mathog To: Subject: Request for warnings on implicit bool to int conversions Message-ID: <97d1c137f40ae4bd6c6f89bfdbdd02ce@saf.bio.caltech.edu> X-Sender: mathog@caltech.edu User-Agent: Roundcube Webmail/0.7 X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: mathog@caltech.edu X-SA-Exim-Scanned: No (on newsaf.bio.caltech.edu); SAEximRunCond expanded to false X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2012-03/txt/msg00426.txt.bz2 The C99 bool data type, and the similar type in C++, currently (v 4.5.2) do not generate warnings for any of these sorts of operations: bool b; b = 3; b++; b += 2; if(b == 3) etc. This can lead to a lot of hidden mischief because a variable declared far away may look like an integer, but it acts like a bool. It would be nice if there was a -Wimplicit_bool that was enabled in -Wall which complained about these sorts of operations. In particular it would warn any time a bool was implicitly promoted to an int. This issued was recently discussed in newsgroup comp.lang.c under the subject: c99 and the lack of warnings when int operations are applied to a bool Thank you, David Mathog mathog@caltech.edu Manager, Sequence Analysis Facility, Biology Division, Caltech