Right now I'm merging two codes with the same core, but they differentiate with the #defines, what I need is to make a way around it an choose wicth configuration I need on run time, the code uses if ENABLE(defined) to verify the configurations to load, how can I modify the code to make it work? Thanks
            Asked
            
        
        
            Active
            
        
            Viewed 3,007 times
        
    -2
            
            
        - 
                    1You can't. By the time the compiler starts compiling your code, there is no trace of `#define`s and other preprocessor directives left in the source. You need to figure out some other strategy. – Sergey Kalinichenko Oct 17 '17 at 02:05
- 
                    Teeeeeechnically, some levels of debugging symbols let you keep them to enable a better debugging experience :) – chris Oct 17 '17 at 02:13
- 
                    Is it better to declare them as variables and change the dependencies that uses this #defines? But for example, there are a lot of vector using them to declare their size, and I can't simple declare a vector size with a int like vector [int]... – Dale queiroz Oct 17 '17 at 02:26
- 
                    @AlessandroQueiroz, Vector sizes can be runtime values. Did you mean arrays? – chris Oct 17 '17 at 02:38
- 
                    I would suggest you rephrase your question. :-) The way you've phrased it already has an answer, and the answer is "You can't.". Perhaps a more detailed explanation of what you ultimately want to accomplish instead of asking how to make a particular idea you had for accomplishing it work? – Omnifarious Oct 17 '17 at 03:06
- 
                    @chris, yes an array, sorry... – Dale queiroz Oct 17 '17 at 10:11
1 Answers
2
            
            
        You can't. Macro are pre-processor. They are gone during compilation. Variables are the best choice. By the way, this question is answered here.
 
    
    
        NightWalker
        
- 31
- 6
