On Mar 3, 2016, at 6:21 AM, Bernd Schmidt <bschm...@redhat.com> wrote:
> What C standard can we assume for libiberty? I was looking at patching this 
> and discovered that SIZE_MAX is defined only for C99, so I'm leaning towards 
> retaining the ints and using INT_MAX.

As long as you don’t need a constant…  you can also do something like:

#ifndef SIZE_MAX
#define SIZE_MAX   (sizeof (size_t) == sizeof (int) ? INT_MAX : sizeof (size_t) 
== sizeof (long) ? LONG_MAX : (abort (), 0))
#endif

but, you need to consider the signedness of it.  A size bounded by int might be 
annoying if an int was 16 bits, but, we don’t care about such platforms hosting 
gcc, so, not a problem in reality.  Once we get to 32-biit (or more), we’re 
good.  No one better have a symbol >2 billion bytes.  And if they do, they can 
submit that patch to fix it in about 1000 years.  :-)  I think an INT_MAX only 
version is fine.

Reply via email to