This question already has answers here:
Changing a macro at runtime in C
(5 answers)
Closed 5 years ago.
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
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.
Changing a macro at runtime in C
Related
This question already has answers here:
SSE SSE2 and SSE3 for GNU C++ [closed]
(5 answers)
What are intrinsics?
(4 answers)
Closed 1 year ago.
What is meant by SSE intrinsics from c++ development point of view? All I could find is that they help things to run faster on a specific platform. But what does it actually means? Does it mean that in the code I will see some #ifdef code for each platform? Or does it mean something else?
Another doubt is that if I am looking at a GitHub project then how can I check if it has used intrinsics for any of the supported platform? Where can I browse to see if this has been done for any platform in the GitHub project itself? Can I search for any specific text to make the search faster?
This question already has answers here:
How will i know whether inline function is actually replaced at the place where it is called or not?
(10 answers)
Closed 8 years ago.
I am trying to diagnose a weird performance problem that I think is related to a failure of GCC to inline some function calls in C++, though I am not sure which function calls. Is there a flag to GCC to list all line numbers where inlining was performed?
The answer to your question is here:
C++: How will i know whether inline function is actually replaced?.
The question was slightly different from yours, but the responses are spot-on - and definitely enlightening. I encourage you to read them.
In answer to your question, however:-Winline will generate a warning if the compiler chooses not to inline:
https://gcc.gnu.org/onlinedocs/gcc-4.6.3/gcc/Warning-Options.html
This question already has answers here:
C++ equivalent of java's instanceof
(5 answers)
Closed 9 years ago.
How can I check the class type in c++?
In Java I used instanceof.
I prefer not to use dynamic cast, but only classic c++.
Is there any way?
Clarification:
It isn't a duplicate of another question in StackOverflow, since I asked how can I find it without using of dynamic_cast. In the other question, the answer was to use it. Please don't mark it as a duplicated.
There is no way to check class type without RTTI or it's home brew substitution. If application compiled without RTTI information about type is not stored anywhere.
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
A free tool to check C/C++ source code against a set of coding standards?
hi,
is there tool equivalent to checkstyle for (visual) C++ ?
I wasn't able to find anything on the internet..
thanks...
EDIT
Duplicate of : A free tool to check C/C++ source code against a set of coding standards?
uncrustify - Source Code Beautifier for C, C++
Check out this one on sourceforge: GreatCode. I really like the configuration options that it provides for C/C++.
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Calling functions from main() in c++
Hello.
I have a programme that has about 100 classes and more than 1000 functions spread over 20 header and source code files. What I want to know is that how I can pass arguments to so many functions in so many files? What is the procedure adopted for this in main()?
Regards,
Supriyo
Take a look at the Boost.Program_options module.