From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eli Zaretskii" To: kevinb@cygnus.com Cc: jeffh@redhat.com, gdb-patches@sourceware.cygnus.com Subject: Re: [RFA] fix gdb.base/remote.c for small int targets Date: Fri, 31 Aug 2001 09:01:00 -0000 Message-id: <3791-Fri31Aug2001185918+0300-eliz@is.elta.co.il> References: <2110-Fri31Aug2001102556+0300-eliz@is.elta.co.il> <1010831152902.ZM23264@ocotillo.lan> X-SW-Source: 2001-08/msg00320.html > Date: Fri, 31 Aug 2001 08:29:02 -0700 > From: Kevin Buettner > > > > +#if INT_MAX < 32768 > > > > Shouldn't you use 32768L or 32768U? If an int is only 16 bits wide, > > 32768 might overflow into the sign bit, and then all bets are off. > > Although not incorrect, using 32768L or 32768U is not necessary. > According to section 7.11.1 of Harbison and Steele: What version of the C standard is this from? If that's C99, I don't think we can assume all compilers comply with it. Anyway, I know at least one compiler which would print a warning about large constants being converted to unsigned. I think it's best to avoid warnings, even if they are not mandated by the standard.