This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] fix gdb.base/remote.c for small int targets
> Date: Fri, 31 Aug 2001 08:29:02 -0700
> From: Kevin Buettner <kevinb@cygnus.com>
>
> > > +#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.