J
Joe Van Dyk
Hi,
Is using // for a comment standard C?
Thanks,
Joe
Is using // for a comment standard C?
Thanks,
Joe
Joe said:Hi,
Is using // for a comment standard C?
Robert said:It was standardized in C99 although it was widely supported as a common
extension before that time. It is probably the most widely supported
C99 feature.
Robert said:It was standardized in C99 although it was widely supported as a
common extension before that time. It is probably the most widely
supported C99 feature.
Joe said:That's what I thought.
(I'm converting all our comments to be doxygen-compatible and I
prefer to use ///.)
gcc continues to support both a pre-processor which does not process //CBFalconer said:Not considered wise from a portability viewpoint.
It is also highly unwise to use it in any media (such as usenet)
where line wrapping can occur.
Zara said:Iif you stuff a really long comment in a single line, you may be
flagged for having very poor coding/commenting style, but it is no
good reason to abandon the use of //
Bill Pursell said:Is there any good reason to adopt its use? Code should not
depend on white-space between tokens. IMO, using '\n' as the
comment termination character is one of the top 10 really bad
ideas in the history of computing.
Hi,
Is using // for a comment standard C?
CBFalconer said:It is also highly unwise to use it in any media (such as usenet)
where line wrapping can occur.
Tim said:gcc continues to support both a pre-processor which does not process //
comments, and one which doe
gcc continues to support both a pre-processor which does not process //
comments, and one which doe
so what? All the world is not GCC.
Richard said:If you used it as an argument that Oreos are available everywhere, yes,
that would be a valid counterpoint.
Richard said:Joe Van Dyk said:
Yes and no. Several reasons have been given for avoiding them in your C90
programs, but nobody appears to have mentioned the fact that modding down
ANSI conformance to allow them will, in some implementations, also
necessarily involve removing some other diagnostic messages. For example,
on the implementation I use most during development, enabling // comments
involves disabling a great many ANSI conformance checks. It's too high a
price.
Joe Van Dyk said:Hm. What implementations might it hinder ANSI conformance checking?
If you used it as an argument that Oreos are available everywhere, yes,
that would be a valid counterpoint.
Joe said:Hi,
Is using // for a comment standard C?
Personally, I really like end-of-line comments ("//" in C99 and C++,
"#" in Perl and shell scripting, "--" in Ada). It's easy to comment
out large blocks of code given a decent editor, there's no ambiguity
about nested comments, and if you're looking at the middle of a large
comment block there's no question that it's in a comment block.
But of course it's a matter of taste, and I don't expect to convince
anyone.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.