Subject: Re: INT*_C macros and inttypes.h
To: Dave Huang <khym@azeotrope.org>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-userlevel
Date: 03/29/2001 12:45:29
Dave Huang wrote:
> (I sent this to netbsd-users, but perhaps tech-userlevel is a better
> place for this... I don't remember if I'm subscribed here, so please cc:
> me on replies)
>
> I was trying to compile some code (which I think was written for Linux),
> and it assumes that if either stdint.h or inttypes.h exist, so do the
> INT{8,16,32,64}_C macros. NetBSD has inttypes.h, but I couldn't find
> the macros anywhere. So who's right? :)
The Single Unix Spec v2 doesn't mention these in its definition of
<inttypes.h>, and there's not reference at all to a <stdint.h>.
However, a little digging turned up:
/* ISO C9x 7.18 Integer types <stdint.h>
* Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794)
...
/* 7.18.4.1 Macros for minimum-width integer constants */
#define INT8_C(VALUE) VALUE
#define INT16_C(VALUE) VALUE
#define INT32_C(VALUE) VALUE
#define INT64_C(VALUE) VALUE##LL
#define UINT8_C(VALUE) VALUE##U
#define UINT16_C(VALUE) VALUE##U
#define UINT32_C(VALUE) VALUE##U
#define UINT64_C(VALUE) VALUE##ULL
/* 7.18.4.2 Macros for greatest-width integer constants */
#define INTMAX_C(VALUE) VALUE##LL
#define UINTMAX_C(VALUE) VALUE##ULL
in http://lists.sourceforge.net/archives//mingw-users/2000-September/000301.html.
There's more info at http://www.cfaq.org/c9x/sc22n2794.txt.
Maybe we should be looking at this. I'll raise a PR for it.
Simon.
--
Simon Burge <simonb@wasabisystems.com>
NetBSD CDs, Support and Service: http://www.wasabisystems.com/