incorrect enum warning?

Luigi Rizzo rizzo at icir.org
Thu May 1 07:59:12 PDT 2003


On Thu, May 01, 2003 at 04:51:40PM +0200, Dag-Erling Smorgrav wrote:
...
>         PAM_SILENT                      = 0x80000000,
...
> cause the following warning when compiled with CSTD=c99:
> 
> /usr/src/contrib/openpam/include/security/pam_constants.h:100: warning: ISO C restricts enumerator values to range of `int'
> 
> when 0x80000000 is clearly within the range of 'int' on all platforms
> we support?

maybe 0x80000000 gets interpreted as unsigned and then the compiler
complains. E.g. in machine/limits.h you find

#define INT_MIN         (-0x7fffffff - 1)       /* min value for an int */   

(to tell the truth you also find there the following definition
for UINT_MAX, and I don't understand why the 'U' is necessary then)

#define UINT_MAX        0xffffffffU     /* max value for an unsigned int */

	cheers
	luigi

> DES
> -- 
> Dag-Erling Smorgrav - des at ofug.org
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"


More information about the freebsd-hackers mailing list