Re: [PATCH] Make large enum constants unsigned
"Frank Ch. Eigler" <[email protected]> Thu, 29 May 2014 16:30:58 -0400
| Newsgroups | gmane.comp.tools.cgen.devel |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> > > * 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