On Thu, 3 Mar 2016, Mike Stump wrote: > 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
If you don't require usability in #if (so can use casts), ((size_t) -1) suffices as a value of SIZE_MAX (size_t is always unsigned). -- Joseph S. Myers jos...@codesourcery.com