Conditional configuration of a C++ module
I am looking for ways to configure a C++ 20 Module. For instance:
in ordinary (pre C++ 20) code I have this conditional compilation:
#if CONDITION == 1
If this conditional code is in a .ixx file (module interface file), how can I configure it?
Since I cannot use macros that are visible in the module, I thought I'd use a :
export constinit int configuration = 1;
#if configuration == 1
This does not seem to work either because preprocessor occurs before compilation.
Last edited on
It depends on what you are trying to achieve with this condition.
Normally I would say: Put the conditional code each in its own file. Depending on what you want to do include the one or other in your project.
Topic archived. No new replies allowed.