This is the mail archive of the cgen@sourceware.org mailing list for the CGEN project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Make large enum constants unsigned


Hi -

> [...]
> Ok, that's fine by me if others are ok with it.
> Below is the patch that does that.
> 
> 2014-05-29  Stefan Kristiansson  <stefan.kristiansson@saunalahti.fi>
> 
> 	* enum.scm (gen-enum-decl): Emit 'U' after constants.
> [...]

One last piece of homework: can you identify in your patch the range
of c compilers / standards-compliance-CFLAGS tested with this change?
I'm a bit worried that U-suffixing may be rejected by earlier or
non-gnu compilers.  

A little experiment shows, gcc 4.8 with -ansi -pedantic outright
rejects large integers, with or without U suffix.

 gcc  -ansi -pedantic -c foo.c     
foo.c:1:14: warning: ISO C restricts enumerator values to range of âintâ [-Wpedantic]
 enum i { x = 4000000000U };

It accepts with a     (int)4000000000    casting formulation instead.

- FChE


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