[Freeciv-Dev] Re: Say Yes to C++ style comments
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Fri, Nov 30, 2001 at 10:08:16PM -0800, Raahul Kumar wrote:
>
> --- Reinier Post <rp@xxxxxxxxxx> wrote:
> > > >
> > > > > http://gcc.gnu.org/c99status.html
> > > > >
> > > > > </pedant>
> > > >
> > > > I'd like a vote from the current developers and maintainers. Make using
> > //
> > > > comments legal.
> > >
> > > Does anyone have an example where freeciv is compiled with a compiler
> > > that cannot handle "//"??
> > >
> > > If not I think we should allow it... Even if it might pose a problem for
> > > someone somewhere sometime in the future...
> >
> > /tmp % cat << ZZ > comment.c
> > ? int main(int argc, char argv[]) {} // and a comment
> > ? ZZ
> > /tmp % make comment
> > cc comment.c -o comment
> > "comment.c", line 1: syntax error before or at: /
> > "comment.c", line 1: undefined or not a type: and
> > "comment.c", line 1: cannot recover from previous errors
> > cc: acomp failed for comment.c
> > make: *** [comment] Error 2
> > /tmp % make CC=gcc comment
> > gcc comment.c -o comment
> > /tmp % rm comment
> > /tmp % make CFLAGS=-xCC comment
> > cc -xCC comment.c -o comment
> >
> > cc is Sun's commercial compiler. I suppose it would be good enough to add
> > adding a test for this compiler (e.g. use this:
> >
> > /tmp % cc -V
> > cc: WorkShop Compilers 5.0 98/12/15 C 5.0
> >
> > ) and add the -xCC flag if the test succeeds.
>
> Damn it. Ok, I retract my suggestion. When will sun fix this rather crappy
> compiler? By the way, are people on sun machines mostly using cc or gcc? On
> the solaris boxes at my university we have both.
All you need is some autoconf magic to add -xCC if cc is found to be Sun's.
So this particular compiler is not a stumbling block.
However, rewriting all C++ comments to C comments is easy, and there
may be older compilers that do not support such comments at all.
For this reason I'd prefer to avoid them.
--
Reinier
|
|