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 Dec 19, 10:33pm, martin%duskware.de@localhost (Martin Husemann) wrote:
-- Subject: Re: Avoiding #define uint8_t (and similar) in stdint.h

| On Thu, Dec 18, 2014 at 10:35:32PM +0000, Christos Zoulas wrote:
| > Can you explain what is failing? I am not sure that putting all of
| > them in one file achieves the goal because it will make a lot more
| > things visible than they are supposed to be. Like should size_t
| > become visible if you include <sys/stat.h>?
| 
| I think it was macro concatenation to form enum names, like CASE(uint8_t)
| which was supposed to create 
| 
|   case TYPE_uint8_t:
| 
| but the #define for uint8_t was not in scope in the enum declaration, so
| we get TYPE_uint8_t defined, but use "case TYPE___uint8_t:", and there
| was also some template class definition thing very similar. The 
| tech-userland thread Brook pointed at shows another similar macro
| concatenation example.

Ah, ok... Makes sense. It breaks the same way our symbol renames too.
I guess the solution is to always prevent cpp expansions in the macros
that use known symbol names as arguments by forming new names on the fly:
like CASE(uint8,_t)

christos


Home | Main Index | Thread Index | Old Index