|
From: Per W. <pw...@ia...> - 2003-06-23 11:56:17
|
Normally you can put just about anything within the #ifdef/#endif or
#if/#endif block - except that you should be a bit carefull about lines
that ends with a \ or lines that start with #.
Even in a undefined block, the preprocessor will expect \ at the end of
the line to mean a line-continuation with, if the next source line
contains the #endif will spell trouble.
Since the compiler supports nested #ifdef constructs, any #ifdef, #if,
#else, #endif etc. might seriously affect the size of the deactivated
block.
/Per W
On Mon, 23 Jun 2003, Damien . wrote:
> 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 ins=
ide
> 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=E1zs <or...@vp...>
> >To: dev...@li...
> >Subject: Re: [Dev-C++] Comment Delimiters
> >Date: Mon, 23 Jun 2003 10:01:54 +0200
> >
> >Andr=E9 Mac=E1rio Barros wrote:
> >>Dear Users,
> >>
> >>=09Suppose you can=B4t use the /* and */ comment delimiters to put in c=
omments
> >>an area of a code in C++.
> >>=09If 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){...}, wh=
ich
> >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=E1zs
> >
> >
> >
> >-------------------------------------------------------
> >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/msnmob=
ile
>
>
>
> -------------------------------------------------------
> 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=3Dfeatures/junkmail
>
>
>
> -------------------------------------------------------
> 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
>
|