On Fri, 29 Jun 2018 12:34:07 +0200 Hans Åberg <haber...@telia.com> wrote: > > On 29 Jun 2018, at 12:10, Chris Vine <vine35792...@gmail.com> wrote: > > > >> For C++, these are only optional, cf. [1], as they require no padding. So > >> an alternative is to typedef the obligatory int_fast<2^k>_t types, perhaps > >> leaving the API unchanged. > >> > >> 1. https://en.cppreference.com/w/cpp/types/integer > > > > The fixed size integer types are optional in C99/11 also, depending on > > whether the platform provides a fixed size integer of the type in > > question without padding and (for negative integers) a two's complement > > representation. > > Yes, I saw that, too. It is important to ensure two's complement, too, which > the other types do not. > > > If, say, uint8_t is available in stdint.h for C, it > > will be available for C++. §21.4.1/2 of C++17 makes this even more > > explicit: "The [cstdint] header defines all types and macros the > > same as the C standard library header <stdint.h>". > > Which C version? In g++7, __STDC_VERSION__ is not defined, only __STDC__.
In C++17, references to "C" are to ISO/IEC 9899:2011. References to the C standard library are to "the library described in Clause 7 of ISO/IEC 9899:2011". In C++11 and C++14, the references are to ISO/IEC 9899:1999. By default (if you don't use the -std=c++xx flag) g++-7 compiles according to C++14.