From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kevin Buettner To: Eli Zaretskii , jeffh@redhat.com Cc: gdb-patches@sourceware.cygnus.com Subject: Re: [RFA] fix gdb.base/remote.c for small int targets Date: Fri, 31 Aug 2001 08:29:00 -0000 Message-id: <1010831152902.ZM23264@ocotillo.lan> References: <2110-Fri31Aug2001102556+0300-eliz@is.elta.co.il> X-SW-Source: 2001-08/msg00318.html On Aug 31, 10:25am, Eli Zaretskii wrote: > > +#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: Preprocessor constant expressions must be evaluated at compile time, and are subject to some relatively strict constraints. Such expressions must have integral type, and can involve only integer constants, character constants, and the special defined operator. All arithmetic is to be done using types long or unsigned long, as appropriate to the signedness of the operands, which frees the preprocessor from having to deal with several sizes of integer types. Kevin