Re: examples/loadables/getconf.c

2012-10-05 Thread Eric Blake
On 10/05/2012 10:50 AM, Eric Blake wrote: >> and are the two main headers that are this >> explicit about various macros being suitable for use in preprocessor >> arithmetic, and preprocessor arithmetic cannot use casts or sizeof. > > And I think this is a bug in POSIX Never mind. I wasn't lo

Re: examples/loadables/getconf.c

2012-10-05 Thread Eric Blake
On 10/05/2012 10:17 AM, Eric Blake wrote: > On 10/05/2012 10:06 AM, Andreas Schwab wrote: >> Chet Ramey writes: >> >>> Why would you say there's a restriction against using casts or sizeof in >>> a macro like this? >> >> Because it must expand to a valid preprocessor expression. > > C99 5.2.4.2.1

Re: examples/loadables/getconf.c

2012-10-05 Thread Eric Blake
On 10/05/2012 10:06 AM, Andreas Schwab wrote: > Chet Ramey writes: > >> Why would you say there's a restriction against using casts or sizeof in >> a macro like this? > > Because it must expand to a valid preprocessor expression. C99 5.2.4.2.1 Sizes of integer types 1. The values given below

Re: examples/loadables/getconf.c

2012-10-05 Thread Andreas Schwab
Chet Ramey writes: > Why would you say there's a restriction against using casts or sizeof in > a macro like this? Because it must expand to a valid preprocessor expression. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4

Re: examples/loadables/getconf.c

2012-10-05 Thread Chet Ramey
On 10/5/12 11:27 AM, Greg Wooledge wrote: > On Fri, Oct 05, 2012 at 05:20:23PM +0200, Andreas Schwab wrote: >> Greg Wooledge writes: >> >>> Line 1209 says: >>> # if (ULLONG_MAX != LLONG_MAX) >>> >>> LLONG_MAX expands to: >>> ((long long int) (~ (long long int) 0 - ((long long int) ((! ((long long

Re: examples/loadables/getconf.c

2012-10-05 Thread Greg Wooledge
On Fri, Oct 05, 2012 at 05:20:23PM +0200, Andreas Schwab wrote: > Greg Wooledge writes: > > > Line 1209 says: > > # if (ULLONG_MAX != LLONG_MAX) > > > > LLONG_MAX expands to: > > ((long long int) (~ (long long int) 0 - ((long long int) ((! ((long long > > int) 0 < (long long int) -1)) ? ~ (long

Re: examples/loadables/getconf.c

2012-10-05 Thread Andreas Schwab
Greg Wooledge writes: > Line 1209 says: > # if (ULLONG_MAX != LLONG_MAX) > > LLONG_MAX expands to: > ((long long int) (~ (long long int) 0 - ((long long int) ((! ((long long int) > 0 < (long long int) -1)) ? ~ (long long int) 0 << (sizeof (long long int) * 8 > - 1) : (long long int) 0 Tha