B
Belloc
Guest
In the picture below you can see (in the Output window) that the macro assert was expanded in a release build, as `((void)0)`. This is in accordance with the definition of the assert macro in <assert.h>, as can be seen in the right portion of the picture. The red squiggles in the picture are probably a bug from Intellisense, as the code compiles without a problem.
To show that the assert macro definition in a release build does not necessarily has to expand to `(void(0))` I made a copy of the file assert.h in the library to the project directory with a small change: I erased the `(void(0))` from the macro definition. You can see this in the right portion of the next picture below. I then compiled the code with #include "assert.h" in place of #include <assert.h> used previously. You can see that the macro expansion in the Output window changed from `((void)0)` to nothing, and the code also compiled correctly without any problem.
Then, why does the assert macro has to expand to `((void)0)` in a release build?
Continue reading...
To show that the assert macro definition in a release build does not necessarily has to expand to `(void(0))` I made a copy of the file assert.h in the library to the project directory with a small change: I erased the `(void(0))` from the macro definition. You can see this in the right portion of the next picture below. I then compiled the code with #include "assert.h" in place of #include <assert.h> used previously. You can see that the macro expansion in the Output window changed from `((void)0)` to nothing, and the code also compiled correctly without any problem.
Then, why does the assert macro has to expand to `((void)0)` in a release build?
Continue reading...