New answers tagged macros
0
Generally, you should not use macros in C++ at all. The main reason is that macros do not respect scope, they simply drop a chunk of code in the middle of your source file. This can cause all manner of bugs which will be very hard to find, because you would have to do this textural insertion in your head.
In C++, if the cost of a function call is your ...
7
Macros in both C and C++ are a text replacement mechanism. Because of that, you can't define a macro in one source file and use it in a different source file.
What you can do is define a macro in a header file and include that header in both C and C++ source files where you want to use that macro.
Such a header would need to contain only code that comes ...
Top 50 recent answers are included