tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Avoiding #define uint8_t (and similar) in stdint.h
On Thu, 18 Dec 2014, Martin Husemann wrote:
We have this strange construct in <stdint.h>:
#ifndef uint8_t
typedef __uint8_t uint8_t;
#define uint8_t __uint8_t
#endif
[...]
I can not recall why we do the double bounce, but one way to avoid the
different names would be:
#define uint8_t uint8_t
IIRC special macro expansion rules make this a valid construct and it probably
can not break valid C++ code.
My preference is to do that. I made such a proposal in one of the
public mailing lists earlier this year, but I have made no attempt to
implement it.
Another option would be to remove the #ifdef dance alltogether and just risk
duplicate (but identical) typedefs, using the compiler predefined defines:
typedef __UINT8_TYPE__ uint8_t;
That's not allowed, and gcc warns about it with -Werror=pedantic.
--apb (Alan Barrett)
Home |
Main Index |
Thread Index |
Old Index