[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnulib] linebreak.c proposed patches for size-calculation overf

From: Paul Eggert
Subject: Re: [Bug-gnulib] linebreak.c proposed patches for size-calculation overflows
Date: 04 Nov 2003 13:19:33 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Bruno Haible <address@hidden> writes:

> > > #ifndef SIZE_MAX
> > > # define SIZE_MAX ((size_t) -1)
> > > #endif
> >
> > xsize.h shouldn't define SIZE_MAX, as various standard headers define
> > it to a better value (one that can be used in #if), and the better
> > value will collide with this macro definition.
> OK, I can #include <stdint.h> as well.

That won't suffice.  Many platforms have inttypes.h but not stdint.h.
And there are many platforms where SIZE_MAX is put in some other
header.  For example, Solaris 9 puts it into <limits.h>.  I don't
think we can easily find out all the variants in this area; it will be
a porting hassle with no real payoff.

> > We could define a differently-named macro, SIZE_MAXIMUM, say.
> This would be against our general strategy for gapping missing definitions

Then let's just use ((size_t) -1), without any macro.  That won't
collide with anything.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]