This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: 0xffffffff when BFD64


> Date: Fri, 7 Apr 2000 14:17:41 +1000 (EST)
> From: Alan Modra <alan@linuxcare.com.au>
> cc: binutils@sourceware.cygnus.com
> 
> On Fri, 7 Apr 2000, I wrote:
> 
> > Alexandre, to get this result your sun compiler apparently is sign
> > extending 0xffffffff.
...
> I guess we should check all hex constants in the range 0x80000000 to
> 0xffffffff, replacing them with const & N_ONES(32).  Blechh.
> 
> Has anyone a better idea?

This is because, IIRC, the Sun compiler is K&R C and considers all
constants to be 'int' constants unless you say otherwise.  ISO C picks
a type based on whether they fit, so such constants become 'unsigned
int'.

One easy solution is to write '0xffffffffu', which is an explicitly
unsigned constant.  There is some GCC warning flag which will complain
about this, saying 'constant is so large it is unsigned'; it is turned
on for GCC itself.

-- 
- Geoffrey Keating <geoffk@cygnus.com>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]