Re: [PATCH] Make large enum constants unsigned

"Maciej W. Rozycki" <[email protected]>
Newsgroups gmane.comp.tools.cgen.devel
Message-ID <[email protected]>
On Thu, 22 May 2014, Stefan Kristiansson wrote:

> this fixes a bug noted in two threads on the binutils mailing list:
> https://sourceware.org/ml/binutils/2014-05/msg00152.html
> https://sourceware.org/ml/binutils/2014-05/msg00195.html
> 
> Both threads describe the problem pretty well, but the gist of it
> is that constants are generated that will be interpreted as signed.
> 
> 2014-05-22  Stefan Kristiansson  <[email protected]>
> 
> 	* enum.scm (gen-enum-decl): Emit 'ULL' after constants larger than
> 	 #x80000000

 Well, `ULL' is non-standard for pre-C99 compilers and also not needed 
because an enum will never have a type that is wider than `int'.  So for 
portability's sake I suggest that you use `U' or `u' as I proposed (I 
prefer lowercase `u' for decimal constants because I find it easier to 
spot among digits, however please feel free to take your pick).

  Maciej
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.