From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18566 invoked by alias); 6 Feb 2003 08:50:34 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 18551 invoked from network); 6 Feb 2003 08:50:33 -0000 Received: from unknown (HELO gatek.vs.dasa.de) (53.122.197.194) by 172.16.49.205 with SMTP; 6 Feb 2003 08:50:33 -0000 Received: from mailrelay1.vs.dasa.de by gatek.vs.dasa.de via smtpd (for sources.redhat.com [66.187.233.205]) with SMTP; 6 Feb 2003 08:51:27 UT Received: from ulm001.sysde.corp (ulm001.sysde.corp [149.207.22.81]) by mailrelay1.de.sysde.corp (8.10.2+Sun/8.10.2) with ESMTP id h168oSx19164; Thu, 6 Feb 2003 09:50:28 +0100 (MET) Received: from [149.207.225.157] (149.207.225.157 [149.207.225.157]) by ulm001.sysde.corp with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2656.59) id 1JSZ5RS1; Thu, 6 Feb 2003 09:50:28 +0100 Subject: RE: How to supress this warning From: Matthias Oltmanns To: Rob Curtis , gcc-help@gcc.gnu.org, gcc@gcc.gnu.org In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Thu, 06 Feb 2003 08:50:00 -0000 Message-Id: <1044521429.1631.29.camel@karpov> Mime-Version: 1.0 X-SW-Source: 2003-02/txt/msg00064.txt.bz2 Hi Rob, thank you for your reply. Am Don, 2003-02-06 um 07.10 schrieb Rob Curtis: > This warning is telling you that 'if( whatever < 0)' will always be > false therefore why have it. > > Why would you wan't to suppress this message? > I'am using heavily generic programing concepts. There are some situations, where i would like to know, if an integer type is signed or unsigned. E.g.: template class Foo { ... }; In the context of class Foo i would like to know, if int_type is signed or not. Normally i could use std::numeric_limits::is_signed() but in my version g++ 2.96 (no, i cannot upgrade to 3.2 :-( ) these is not available. Therefor i have the following template class: template struct IS_SIGNED { enum { RET = (int_type(-1) < 0 ? 1 : 0) }; }; With this, i can write ... template class Foo { void blah() { if (IS_SIGNED::RET) { do_left(); } else { do_right(); } } }; Of course, i could use template specialisation and define IS_SIGNED for each integer type, but i wonder if it is possible in the way i've explained. I'm using -Werror and many warnings enabled. Here is the list: WARNFLAGS = -W -Wall -Wpointer-arith -Woverloaded-virtual -Wno-sign-compare -Werror If i use IS_SIGNED with an instance for an unsigned integer the comparison evaluates to false, always of course. But thats the nature of static programming. So my question again, is it possible to suppress this kind of warning? Matthias Oltmanns > Rob Curtis > > > -----Original Message----- > From: Matthias Oltmanns > [mailto:Mathias.Oltmanns.Oltmanns@sysde.eads.net] > Sent: Wednesday, 5 February 2003 8:41 PM > To: gcc-help@gcc.gnu.org > Subject: How to supress this warning > > Hi, > > i would like to supress the following warning: > > warning: comparison of unsigned expression < 0 > is always false > > Which of the warning flags is appropriate to supress the warning? GCC > version is "gcc version 2.96 20000731 (Red hat Linux 7.1 2.96-85)" > > Thanks in advance. > Matthias > > -- > Matthias Oltmanns > > Tel: 04421-1543-274 > mail: Mathias.Oltmanns.Oltmanns@sysde.eads.net -- Matthias Oltmanns Tel: 04421-1543-274 mail: Mathias.Oltmanns.Oltmanns@sysde.eads.net