This one bit me today

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Oct 20 23:07:31 AEST 1989


In article <273 at bbxsda.UUCP> scott at bbxsda.UUCP (Scott Amspoker) writes:
>I don't get it.  Are you saying that a C compiler that allows the option
>of nested comments is *broken*?  I believe Turbo C has a nested comments
>option.  I agree that a compiler that insists on nesting comments is
>probably non-conforming (I say "probably" because I can't recite the
>actual ANSI text at this moment).  But what's wrong with command line
>options that allow various enhancements?

C does not now, and never has, permitted nested /*...*/ comments.
A compiler when it does treat /*...*/ comments as nesting (however
the compiler is invoked) is not processing the C programming language.
If it is advertised as a C compiler in that mode, then yes it is broken.

What is wrong with this "enhancement" is that it is not a transparent
extension.  It encourages writing code that looks like C but performs
differently from the way C code would.  When ported to a genuine C
environment, its operation can change, perhaps silently getting wrong
answers when compiled by a true C compiler.

Vendor extensions to C should be clearly identifiable, so that it is
easy to determine if an application is relying on them, and they should
be designed to cause diagnostics when code using them is compiled in an
environment that does not support the extensions.



More information about the Comp.lang.c mailing list