|
From: Damien . <g_...@ho...> - 2003-06-23 10:41:30
|
Guys, How exactly does '#if 0' ...#endif work? I assumed that the
preprocessor would skip the statements until it reached the #endif.
However, when I tried to compile the code(with gcc 3.2.2) below , i get a
"missing terminator character ' error" . It seems as though the code inside
of an #if 0...#endif statement must be C/C++ accurate. It is easy fixed
with a /*... */ .Care to elaborate....?
/* IfZero.c */
#include <stdio.h>
int main(void)
{
#if 0
This line should not be worried about. I'm quite sure it will *not* be
included.
#endif
printf("...");
return 0;
}
----Original Message Follows----
From: "Daniel Glenfield" <sp...@ho...>
To: or...@vp..., dev...@li...
Subject: Re: [Dev-C++] Comment Delimiters
Date: Mon, 23 Jun 2003 09:16:30 +0100
Agreed. #if 0 ..#endif is a great way of doing it.
>From: OROSZI Balázs <or...@vp...>
>To: dev...@li...
>Subject: Re: [Dev-C++] Comment Delimiters
>Date: Mon, 23 Jun 2003 10:01:54 +0200
>
>André Macário Barros wrote:
>>Dear Users,
>>
>> Suppose you can´t use the /* and */ comment delimiters to put in comments
>>an area of a code in C++.
>> If I use the // command, must I put them in each line of this piece of
>>code?
>> Is there another way?
>
>There is a quick way:
>
>#if 0
>...
>#endif
>
>Because "0" is "false", #if 0 can be considered like if (false){...}, which
>will in fact, never execute. So all code, with or without comments, will
>not be parsed by the C preprocessor there.
>
>This approach is also better, because /* */ comments cannot be nested.
>
>--
>Greetings,
> Balázs
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by: INetU
>Attention Web Developers & Consultants: Become An INetU Hosting Partner.
>Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
>INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
_________________________________________________________________
On the move? Get Hotmail on your mobile phone http://www.msn.co.uk/msnmobile
-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
|