From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30761 invoked by alias); 13 Oct 2002 15:18:06 -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 30754 invoked from network); 13 Oct 2002 15:18:06 -0000 Received: from unknown (HELO bclcl1.im.battelle.org) (131.167.1.2) by sources.redhat.com with SMTP; 13 Oct 2002 15:18:06 -0000 Received: from ns-bco-scn1.im.battelle.org ([131.167.1.122]) by BCLCL1 (PMDF V5.1-10 #U2779) with SMTP id <01KNM4NSUYHY95S2O3@BCLCL1> for gcc-help@gcc.gnu.org; Sun, 13 Oct 2002 11:18:12 EDT Received: from 131.167.1.91 by ns-bco-scn1.im.battelle.org (InterScan E-Mail VirusWall NT); Sun, 13 Oct 2002 11:18:02 -0400 Received: by ws-bco-mse1.milky-way.battelle.org with Internet Mail Service (5.5.2655.55) id ; Sun, 13 Oct 2002 11:18:03 -0400 Date: Sun, 13 Oct 2002 08:18:00 -0000 From: "Moore, Mathew L" Subject: RE: Bug with unsigned int data type? To: 'Steve Dondley' , gcc-help@gcc.gnu.org Message-id: <2F05A390F72A0A409390E016D23E45E8042DBE17@ns-bco-mse4.im.battelle.org> MIME-version: 1.0 Content-type: text/plain; charset="iso-8859-1" X-SW-Source: 2002-10/txt/msg00148.txt.bz2 If there is no suffix on an integer constant, according to the C99 standard, it must be converted to the first type on the list {int, long int, long long int} in which its value can be represented. So maybe the warning should say something about the conversion from long long to unsigned? The C89 standard, which gcc 2.95 probably follows a little more closely, had the conversion list as {int, long int, unsigned long int}, so maybe then the warning should go away. But then again, it might be nice for the programmer to know when that conversion is occuring. gcc 3.2 still gives the warning you see. You can get around that warning by using the suffix on the constant: n = 2147483648u; --Matt > -----Original Message----- > From: Steve Dondley [mailto:s@dondley.com] > Sent: Sunday, October 13, 2002 10:29 > To: gcc-help@gcc.gnu.org > Subject: Bug with unsigned int data type? > > > Hi, > > The following two lines... > > unsigned int n; > n = 2147483648; > > ...generate a "decimal constant is so large thst it is > unsigned" warning. > Shouldn't the declaration of the integer as unsigned avoid > this warning? > I'm using gcc version 2.95.4 on an Intel 32 bit machine. > > Thanks. > >