Page MenuHomeFeedback Tracker

## Preprocessor operator not processed correctly
New, NormalPublic

Description

#define TF_RADIO_IDS_10(baseClass,displayNameBase,index10) \
class baseClass##_##index10##1 : baseClass {displayName = displayNameBase index10##1; };
#define TF_RADIO_IDS_100(baseClass,displayNameBase,index100) \
    TF_RADIO_IDS_10(baseClass,displayNameBase,index100##1)
TF_RADIO_IDS_100(ItemRadio,test,1)

With this macro i would expect the class ItemRadio_111 to be created.
Because the processed string should be

ItemRadio##_##index100##index10##1  -> ItemRadio##_##1##1##1.
But the real Preprocessor output of binarize.exe will be ItemRadio_1##1 which is of cause unusable.
It seems like the ## operator will not be evaluated when it was used in a Parameter to a macro.

In my case i have to generate 1000 items which are all only different by classname and the number at the end of their classname. It was previously done by having a 1000 line macro which is horrendous.
Mikeros Rapify tool does it just fine btw.

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 8 x64
Category
Tools
Steps To Reproduce

create config.cpp with content

#define TF_RADIO_IDS_10(baseClass,displayNameBase,index10) \
class baseClass##_##index10##1 : baseClass {displayName = displayNameBase index10##1; };
#define TF_RADIO_IDS_100(baseClass,displayNameBase,index100) \
    TF_RADIO_IDS_10(baseClass,displayNameBase,index100##1)
TF_RADIO_IDS_100(ItemRadio,test,1)

and run binarize.exe on it.

Event Timeline

dedmen created this task.Sep 30 2016, 3:01 AM
dedmen updated the task description. (Show Details)
dedmen updated the task description. (Show Details)Sep 30 2016, 3:04 AM
dedmen renamed this task from ## Preprocessor directive not processed correctly to ## Preprocessor operator not processed correctly.Sep 30 2016, 3:34 AM
dedmen updated the task description. (Show Details)