How to disregard code.

Hi guys, this will sound rather silly im sure but I want to know how do I disregard large chunks of code when i don't need it? I don't want to delete the code just tell the compiler not to use it when running.

I already know the line by line way which is // but whats the other??

thanks guys
for anyone interested in the answer which I eventually worked out it's

/*


*/
I would go with

1
2
3
#if 0
//unneeded code
#endif 


because you can't nest /**/ .
Last edited on
Well looks like their is more than one way, thanks for the info.
+1 R0mai
I was going to suggest using preprocessor too; if you wanted to write something that only ran on Windows, you would put #ifdef _WIN32 etc.

But if you mean the commenting way, then yes, it's
1
2
/*
 */
The industry standard way is to use R0mai's method.

C and C++ programmers just recognize #if 0 as a comment for temporary or changing code.

The normal comment delimiters (/* and */) is for production/finished stuff. Consider it the same as part of the code.

Hope this helps.
Topic archived. No new replies allowed.