Skip to main content
gamedev.net
🔒 Locked

#if 0

Started by q2guy 4 replies 300+ views
Original Post
q2guy
q2guy
what means preprocessor directive #if 0 ... #endif ?? thnx
daerid
daerid
It''s an easy way of removing source code from a compiled program, without having to worry about nested c-style comments.

anything between the #if 0 ... #endif

isn''t included in the final executable
daerid@gmail.com
Michalson
Michalson
Sounds like Carmack code.

#if 0
==
#if false
==
Debugging code, so never do this again

The compiler ignores everything in that block.
felonius
felonius
It means that whatever is between those two directives will *not* be compiled. The compiler simply jumps over them. It is done by some programmers as a way to comment a large section of code out. Unlike /* */ the #if 0 ... #endif can be nested.
Jacob Marner, M.Sc.Console Programmer, Deadline Games
felonius
felonius
Man, people answer fast in this forum
Jacob Marner, M.Sc.Console Programmer, Deadline Games
q2guy
q2guy
thnx for replys, you are fast! xD

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.