#if 0?

I know this is OFFTOPIC but what means #if 0 ??? I asked it here, because it might be interesting for
other Coders too.

Thanks.

#if 0
whatever
#endif

keeps the whatever from compiling.

Andrew

— Torsten Giebl wrote:> I know this is OFFTOPIC but what means #if 0 ??? I

asked it here, because it might be interesting for
other Coders too.

Thanks.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Do You Yahoo!?
Yahoo! Health - Feel better, live better

It’s an #if statement which will never be true. (0 is false :^) )

So it’s an easy way of doing something like this:

/*

a whole
bunch of code
you wish to
comment out

*/

Except it’s not affected by any existing comments. e.g.:

/*

this could cause    /* foo-bar-baz */
a syntax error      /* <-- this is no longer commented-out! */

/ / <-- this is a syntax error! */

So you just go:

#ifdef 0

stuff you
want commented out      /* comments won't affect it */
go here

#endif

Silly, but it works.

-bill!On Mon, Jul 22, 2002 at 10:26:33PM +0200, Torsten Giebl wrote:

I know this is OFFTOPIC but what means #if 0 ??? I asked it here, because it might be interesting for
other Coders too.

AH! :slight_smile:

THANKS.

“nbs” schrieb im Newsbeitrag news:mailman.1027370465.12219.sdl at libsdl.org…> On Mon, Jul 22, 2002 at 10:26:33PM +0200, Torsten Giebl wrote:

I know this is OFFTOPIC but what means #if 0 ??? I asked it here, because it might be interesting for
other Coders too.

It’s an #if statement which will never be true. (0 is false :^) )

So it’s an easy way of doing something like this:

/*

a whole
bunch of code
you wish to
comment out

*/

Except it’s not affected by any existing comments. e.g.:

/*

this could cause    /* foo-bar-baz */
a syntax error      /* <-- this is no longer commented-out! */

/ / <-- this is a syntax error! */

So you just go:

#ifdef 0

stuff you
want commented out      /* comments won't affect it */
go here

#endif

Silly, but it works.

-bill!