Thursday, 17 December 2009

__COUNTER__

The pre-processor provides some keywords: __FILE__, __LINE__, and __COUNTER__. They provide you with some locality information, however, counter is only relative to itself.

If you read my earlier post on the nastiness of the ## command in the pre-compiler, then you'll be able to guess what this is going to be used for.

multiple uniquifying identifier function(issimo)

#define APPENDER(x) PASTER1(x,__COUNTER__)
#define PASTER1(x,y) PASTER2(x,y)
#define PASTER2(x,y) x##y

Okay, now you have a unique in that file, identifier system. Go team.
Post a Comment