Suggestion
Blitz3D Forums/Blitz3D Programming/Suggestion
| ||
Hi! Maybe this isn't where to post this, but I can't find a place that looks more appropriate. It would be nice if you could conditionally tell the compiler to include code. Like in c++: #ifdef DEBUG SuperSlowDebugFunction(); #endif I'm writing a sprite manager in Blitz3D, and would like to include debug info, but don't want the debug code slowing down the release version. |
| ||
Is this true? Found this on Syntax Error's Tips page... Compiler Directives Use constants when developing to prevent sections of code being compiled into the exe. Blitz would NOT complie the Print statement in this example. There will be no trace in the executable: |
| ||
Correct. This can be done. Just use const. const DEBUG = false ... if DEBUG then SuperSlowDebugFunction(); end if the "SuperSlowDebugFunction(); " would not be compiled in this example. cb |
| ||
Interesting.... never knew that. |
| ||
Is that true? Is the block of code optimised out of compilation when using If 0 ? |
| ||
Very handy for patch-proof save-disabled demo versions etc. |