| Author |
Message |
Joe Van Dyk *nix forums addict
Joined: 06 Mar 2006
Posts: 96
|
Posted: Wed Jun 21, 2006 1:53 am Post subject:
// vs /*
|
|
|
Hi,
Is using // for a comment standard C?
Thanks,
Joe |
|
| Back to top |
|
 |
Robert Gamble *nix forums Guru
Joined: 15 Apr 2005
Posts: 447
|
Posted: Wed Jun 21, 2006 2:24 am Post subject:
Re: // vs /*
|
|
|
Joe Van Dyk wrote:
| Quote: | Hi,
Is using // for a comment standard C?
|
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 Gamble |
|
| Back to top |
|
 |
Joe Van Dyk *nix forums addict
Joined: 06 Mar 2006
Posts: 96
|
Posted: Wed Jun 21, 2006 3:18 am Post subject:
Re: // vs /*
|
|
|
Robert Gamble wrote:
| Quote: | Joe Van Dyk wrote:
Hi,
Is using // for a comment standard C?
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.
|
That's what I thought.
(I'm converting all our comments to be doxygen-compatible and I prefer
to use ///.)
Thanks,
Joe |
|
| Back to top |
|
 |
CBFalconer *nix forums Guru
Joined: 09 Mar 2005
Posts: 2502
|
Posted: Wed Jun 21, 2006 3:41 am Post subject:
Re: // vs /*
|
|
|
Robert Gamble wrote:
| Quote: | Joe Van Dyk wrote:
Is using // for a comment standard C?
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.
|
It is also highly unwise to use it in any media (such as usenet)
where line wrapping can occur.
--
"I don't know where bin Laden is. I have no idea and really
don't care. It's not that important." - G.W. Bush, 2002-03-13
"No, we've had no evidence that Saddam Hussein was involved
with September the 11th." - George Walker Bush 2003-09-17 |
|
| Back to top |
|
 |
CBFalconer *nix forums Guru
Joined: 09 Mar 2005
Posts: 2502
|
Posted: Wed Jun 21, 2006 4:20 am Post subject:
Re: // vs /*
|
|
|
Joe Van Dyk wrote:
| Quote: | Robert Gamble wrote:
Joe Van Dyk wrote:
Is using // for a comment standard C?
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.
That's what I thought.
(I'm converting all our comments to be doxygen-compatible and I
prefer to use ///.)
|
Not considered wise from a portability viewpoint.
--
"I don't know where bin Laden is. I have no idea and really
don't care. It's not that important." - G.W. Bush, 2002-03-13
"No, we've had no evidence that Saddam Hussein was involved
with September the 11th." - George Walker Bush 2003-09-17 |
|
| Back to top |
|
 |
Tim Prince *nix forums Guru Wannabe
Joined: 21 Feb 2005
Posts: 117
|
Posted: Wed Jun 21, 2006 4:52 am Post subject:
Re: // vs /*
|
|
|
CBFalconer wrote:
| Quote: | Joe Van Dyk wrote:
Robert Gamble wrote:
Joe Van Dyk wrote:
Is using // for a comment standard C?
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.
That's what I thought.
(I'm converting all our comments to be doxygen-compatible and I
prefer to use ///.)
Not considered wise from a portability viewpoint.
gcc continues to support both a pre-processor which does not process // |
comments, and one which does. |
|
| Back to top |
|
 |
Zara *nix forums Guru Wannabe
Joined: 20 Jun 2005
Posts: 151
|
Posted: Wed Jun 21, 2006 5:20 am Post subject:
Re: // vs /*
|
|
|
On Tue, 20 Jun 2006 23:41:23 -0400, CBFalconer <cbfalconer@yahoo.com>
wrote:
| Quote: | Robert Gamble wrote:
Joe Van Dyk wrote:
Is using // for a comment standard C?
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.
It is also highly unwise to use it in any media (such as usenet)
where line wrapping can occur.
|
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 //
Zara |
|
| Back to top |
|
 |
bill *nix forums Guru Wannabe
Joined: 12 May 2005
Posts: 241
|
Posted: Wed Jun 21, 2006 5:28 am Post subject:
Re: // vs /*
|
|
|
Zara wrote:
| Quote: | On Tue, 20 Jun 2006 23:41:23 -0400, CBFalconer <cbfalconer@yahoo.com
wrote:
Robert Gamble wrote:
Joe Van Dyk wrote:
Is using // for a comment standard C?
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.
It is also highly unwise to use it in any media (such as usenet)
where line wrapping can occur.
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 //
|
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. |
|
| Back to top |
|
 |
Keith Thompson *nix forums Guru
Joined: 28 Feb 2005
Posts: 5173
|
Posted: Wed Jun 21, 2006 6:05 am Post subject:
Re: // vs /*
|
|
|
"Bill Pursell" <bill.pursell@gmail.com> writes:
| Quote: | Zara wrote:
On Tue, 20 Jun 2006 23:41:23 -0400, CBFalconer <cbfalconer@yahoo.com
wrote:
Robert Gamble wrote:
Joe Van Dyk wrote:
Is using // for a comment standard C?
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.
It is also highly unwise to use it in any media (such as usenet)
where line wrapping can occur.
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 //
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.
|
printf("Hello,
world\n");
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.
One good reason to avoid // comments, as much as I like them, is that
they're not universally supported; another is the Usenet line-wrapping
problem. But the latter could be easily addressed by keeping your
lines reasonably short so they don't wrap.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this. |
|
| Back to top |
|
 |
neutron*star *nix forums Guru
Joined: 21 Feb 2005
Posts: 2039
|
Posted: Wed Jun 21, 2006 7:44 am Post subject:
Re: // vs /*
|
|
|
Joe Van Dyk said:
| Quote: | Hi,
Is using // for a comment standard C?
|
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.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously) |
|
| Back to top |
|
 |
Kenny McCormack *nix forums Guru
Joined: 24 Mar 2005
Posts: 657
|
Posted: Wed Jun 21, 2006 9:54 am Post subject:
Re: // vs /*
|
|
|
In article <4498BFE3.371270CB@yahoo.com>,
CBFalconer <cbfalconer@maineline.net> wrote:
....
| Quote: | It is also highly unwise to use it in any media (such as usenet)
where line wrapping can occur.
|
Damn unwise!
(heh heh) |
|
| Back to top |
|
 |
Nick Keighley *nix forums Guru Wannabe
Joined: 03 Apr 2005
Posts: 209
|
Posted: Wed Jun 21, 2006 10:01 am Post subject:
Re: // vs /*
|
|
|
Tim Prince wrote:
| Quote: | CBFalconer wrote:
Joe Van Dyk wrote:
Robert Gamble wrote:
Joe Van Dyk wrote:
Is using // for a comment standard C?
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.
That's what I thought.
(I'm converting all our comments to be doxygen-compatible and I
prefer to use ///.)
Not considered wise from a portability viewpoint.
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.
--
Nick Keighley |
|
| Back to top |
|
 |
Kenny McCormack *nix forums Guru
Joined: 24 Mar 2005
Posts: 657
|
Posted: Wed Jun 21, 2006 11:19 am Post subject:
Re: // vs /*
|
|
|
In article <1150884078.651539.286840@g10g2000cwb.googlegroups.com>,
Nick Keighley <nick_keighley_nospam@hotmail.com> wrote:
....
| Quote: | 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.
|
I assume that if I pointed out that Nabisco makes at least 2 kinds of
Oreos, you'd "smartly" point out that "All the world is not Nabisco". |
|
| Back to top |
|
 |
Richard Bos *nix forums Guru
Joined: 21 Feb 2005
Posts: 1031
|
Posted: Wed Jun 21, 2006 11:25 am Post subject:
Re: // vs /*
|
|
|
gazelle@xmission.xmission.com (Kenny McCormack) wrote:
| Quote: | In article <1150884078.651539.286840@g10g2000cwb.googlegroups.com>,
Nick Keighley <nick_keighley_nospam@hotmail.com> wrote:
...
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.
I assume that if I pointed out that Nabisco makes at least 2 kinds of
Oreos, you'd "smartly" point out that "All the world is not Nabisco".
|
If you used it as an argument that Oreos are available everywhere, yes,
that would be a valid counterpoint.
Richard |
|
| Back to top |
|
 |
Joe Van Dyk *nix forums addict
Joined: 06 Mar 2006
Posts: 96
|
Posted: Wed Jun 21, 2006 12:39 pm Post subject:
Re: // vs /*
|
|
|
Richard Bos wrote:
| Quote: | gazelle@xmission.xmission.com (Kenny McCormack) wrote:
In article <1150884078.651539.286840@g10g2000cwb.googlegroups.com>,
Nick Keighley <nick_keighley_nospam@hotmail.com> wrote:
...
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.
I assume that if I pointed out that Nabisco makes at least 2 kinds of
Oreos, you'd "smartly" point out that "All the world is not Nabisco".
If you used it as an argument that Oreos are available everywhere, yes,
that would be a valid counterpoint.
|
Mm.... oreos. |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|