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 Fri, Dec 19, 2014 at 04:50:14PM -0500, 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)

nah, the right answer is to not use macros for things that aren't
supposed to be macros :-)

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index