This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Mixing comment styles (ansi C)


* LLeweLLyn Reese <llewelly@lifesupport.shutdown.com> [030728 11:20]:
> Tim Johnson <tim@johnsons-web.com> writes:
> 
> > Hello All:
> >     Using gcc 2.96 on RH 7.2. 
> > My project targets ansi C code only 
> > 
> > but for convenience during testing I'd like to use
> > C++ style comments along with class C comments
> > 
> > Is there a gcc option to do this?
Thanks!
> [snip]
> 
> //-style comments are part of C99, and are enabled by default. gcc
>     2.95.3 disables //-style comments if -ansi is used[0], and I
>     assume gcc 2.96 does the same (but I don't know where to find docs
>     for 2.96, because it was a redhat special and not an official gnu
>     release. ) 
> 
> I don't see a flag to specifically enable or disable them.
> 
> [1] http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#SEC86

 To elaborate: Example
 /* the following statement : */
 Print(obj);    /*Check out our new data */
 /* compiles 
    But if I wish to quickly "comment out" that line as in */
 //Print(obj);    /*Check out our new data */
 /* I receive "parse error before `/'" from gcc 
    I've solved this by commenting out "ANSI=   -ansi -pedantic"
    and replacing by an empty option list in the makefile */
    
Thanks for the reply and putting me in the right direction.

Your comments above lead to another question. :-)
I'd also appreciate further comments on the "redhat special" as
opposed to "official gnu release", pointers to docs would be
fine.

Regards
-- 
Tim Johnson <tim@johnsons-web.com>
      http://www.alaska-internet-solutions.com
      http://www.johnsons-web.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]