On Fri, Sep 04, 2020 at 06:23:10PM +0200, Iain Buclaw wrote:
> If we're already using limits.h, I guess it should be fine to also add
> 
> #define UINT_MAX ((unsigned) ~0U)

Yes, except that I'll use the simpler fall-back
#define UINT_MAX (~0U)

The habit of using a cast for unsigned constants dates back to K&R C
where a U suffix was not valid.  For example, from libiberty/strtol.c
#define ULONG_MAX       ((unsigned long)(~0L))

Since the code uses ISO/ANSI C features such as prototypes I think
we're OK with a U suffix.  And if there's something I'm missing then
#define UINT_MAX ((unsigned) ~0)
would be correct for K&R.

> I'll leave it to your judgement on that though.
> 
> Other than that, OK from me.

Do I need an OK from Ian too?

-- 
Alan Modra
Australia Development Lab, IBM

Reply via email to