Skip to main content
gamedev.net
🔒 Locked

c macro stringification

Started by dietepiet 0 replies 1.2k views
Original Post
dietepiet
dietepiet
Hi, Quick question, whats wrong with:


...

91: #define TEST(a) #a
92: TEST(int b);

...


I expect it to substituted by


...

92: int b;

..


but my MSVC 2005 compiler complains about 1>.\Source\main.cpp(92) : error C2059: syntax error : 'string' Thanx a lot, Dietger
Rewdew
Rewdew
It turns whatever argument you pass into a string so it'd be "int b"; instead of just int b;
There is an option for the preprocessor to output the preprocessed source file, this way you can easily "debug" what's going on.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.