INT_MAX undeclared / limits.h

Ralf Corsepius rc040203 at freenet.de
Wed Feb 13 17:24:48 UTC 2008


On Wed, 2008-02-13 at 18:09 +0100, Till Maas wrote:
> On Wed February 13 2008, Till Maas wrote:
> 
> > Is this really a bug in aireplay-ng, i.e. does it have to include limits.h
> > where INT_MAX comes from, or is this a bug in some other package? Why was
> > it not needed to include limits.h earlier, any ideas?
> 
> In Fedora 7 and 8, INT_MAX is already declared when arpa/inet.h is included, 
> i.e. this compiles:
> 
> #include <arpa/inet.h>
> #include <stdio.h>
> 
> main() {
> printf("%i", INT_MAX);
> }
> 
> But I guess it won't compile in Rawhide. arpa/inet.h comes from glibc-headers 
> which is a subpackage of glibc, so is this a bug in glibc?
Nope. What you describe above simply is unreliable, undocumented
behavior - It might work somewhere, but it also might not work somewhere
else.

POSIX mandates code to include <limits.h> to reliably get INT_MAX.

So all that has happened is: glibc has changed its undocumented
behavior, which some applications had relied upon.
These apps now break, because their implementors missed they had been
relying upon undocumented behavior.

Ralf








More information about the fedora-devel-list mailing list