Comment Style

K

Keith Thompson

Richard said:
Sjouke Burry said:
Ian Collins wrote: [...]
But no one leaves "commented out" code in for long, do they? Code will
only be conditionally compiled out during testing and restored before
the code is committed.

So the only person to scroll "to the middle of a huge block" will be the
person who conditionally compiled out the code. If you have a short
term memory issue, that's a topic for another group.
Ha! I have come across programs, where 60-80 percent was commented
out.

Me too. Collins is being a smart arse again and speaking for the entire
world from his little corner of perfection.
[...]

You know, Richard, if you could manage to comment on things like this
without sinking to personal insults, a lot of us might be more willing
to talk to you.

You can disagree without being disagreeable.

Or you can continue being a smart arse.
 
C

CBFalconer

Eric said:
Richard said:
[...]
I have no idea what you're talking about but I assume you're
taking a cheap shot.
[...]
Collins is being a smart arse again and speaking for the
entire world from his little corner of perfection.

I think that's about all of Richard _'s comment style I
care to see.

I am amazed at the percentage of his acquaintances who are these
"smart arses". I have yet to see a valid definition of the breed.
 
I

Ian Collins

Richard said:
You are a very funny man.

Am I? If anyone on my last team had checked in any files with commented
out code, they'd have been pelted with rotten eggs and forced to run
naked round the building by their peers.
Richard Harter, (e-mail address removed)
http://home.tiac.net/~cri, http://www.varinoma.com
Save the Earth now!!
It's the only planet with chocolate.

You should delimit a sig block with "-- " on its own line.
 
I

Ian Collins

CBFalconer said:
At which point the compilers I use emit a warning.
At which point you have to go through and remove the nested comment, or
find anther way to remove the block.
 
N

Nick Keighley

[ // comments nest] // like // this
I wouldn't call that nesting, that's just including the comment start
sequence inside a comment,

it's what I'd call nesting.

if it really nested then the comment would
continue to the next line in your example.

Note that you can do the same with with C-style comments:
/* this /* is /* legal */

in this quote typos are mine

ANSI X3.159-1989 para 3.1.9
"Except within a character constant, a string literal, or a comment,
the characters /* introduce a comment. The contents of a comment are
examined only to identify multibyte characters and to find the
characters
*/ that terminate it. [footnote]"

"[footnote] Thus, comments do not nest."
 
N

Nick Keighley

[ // comments nest] // like // this
I wouldn't call that nesting, that's just including the comment start
sequence inside a comment,

it's what I'd call nesting.
if it really nested then the comment would
continue to the next line in your example.
Note that you can do the same with with C-style comments:
/* this /* is /* legal */

in this quote typos are mine

ANSI X3.159-1989 para 3.1.9
"Except within a character constant, a string literal, or a comment,
the characters /* introduce a comment.  The contents of a comment are
examined only to identify multibyte characters and to find the
characters
*/ that terminate it. [footnote]"

"[footnote] Thus, comments do not nest."
so I don't see how the C++-style comments have an advantage here.


oops on a re-read I agree with you. There can be multiple
starts nested inside a comment but the first end terminates it

/* /* valid */

/* /* not valid */ */
 
J

James Kuyper

CBFalconer said:
Eric said:
Richard said:
[...]
I have no idea what you're talking about but I assume you're
taking a cheap shot.
In said:
[...]
Collins is being a smart arse again and speaking for the
entire world from his little corner of perfection.
I think that's about all of Richard _'s comment style I
care to see.

I am amazed at the percentage of his acquaintances who are these
"smart arses". I have yet to see a valid definition of the breed.

I found only two comments from him about "smart arse". He uses "arse" a
lot, but he varies the adjective. It's one of those words that tends to
accurately describe the user more often than it fits the person it
nominally is referring to.
 
N

Nick Keighley

CBFalconer said:
Eric Sosman wrote:
In another message posted just one minute later
[Richard <null>] wrote:
Collins is being a smart arse again and speaking for the
entire world from his little corner of perfection.
I am amazed at the percentage of his acquaintances who are these
"smart arses".  I have yet to see a valid definition of the breed.

I found only two comments from him about "smart arse". He uses "arse" a
lot, but he varies the adjective. It's one of those words that tends to
accurately describe the user more often than it fits the person it
nominally is referring to.

It's a UKism. An American might use the term "smart ass".
It has connotations of "too clever by half" someone
who is clever (or thinks they are) and likes to
demonstrate the fact in an obnoxious and annoying manner.

Note: I am merely definign the term and not applying it.
 
C

CBFalconer

Ian said:
At which point you have to go through and remove the nested
comment, or find anther way to remove the block.

Oh well. I will just put up with the extreme anguish.
 
R

Richard

And well they should. What is remarkable is that all programmers
and programming teams do exactly the same thing in exactly the
same way. They do don't they?

I'm beginning to wonder if Ian has cracked. He doesn't really think this
entire thread is about how he personally works surely? Come on Ian,
please tell us you are trolling here.
Richard Harter, (e-mail address removed)
http://home.tiac.net/~cri, http://www.varinoma.com
Save the Earth now!!
It's the only planet with chocolate.

--
 
E

Ed Prochak

Sjouke said:
Ian said:
[...]
But no one leaves "commented out" code in for long, do they?  Code will
only be conditionally compiled out during testing and restored before
the code is committed.
So the only person to scroll "to the middle of a huge block" will be the
person who conditionally compiled out the code.  If you have a short
term memory issue, that's a topic for another group.
Ha! I have come across programs, where 60-80 percent was commented
out.
When asking the author, he said it was because he might want to
use the pieces sometime.........

     "60-80 percent" seems pretty high, but disabling big blocks
and leaving them in the source file is defensible.

Not if you are going to try to call yourself a software engineer.
....  I've often
seen it done with code that implemented a once-necessary work-
around or optimization that isn't needed any more but is kept
around just in case.  After all, the fact that circumstances have
already changed once is no guarantee that change has ceased ...

Then there is a design document filed under the production incident
describing the problem and the workaround. Leaving commented out code
in the current released version of source code is indefensible.
     The compiler isn't really a Software Engineering tool, but
we've all used it as such in small ways.

A compiler is one tool among many including source control, build
tools, design and requirement documentation, bug tracking systems and
others. These are all used by software engineers. A compiler is just a
hammer to brute coders. (and we all know where that leads.)

Ed.
 
I

Ian Collins

Richard said:
I'm beginning to wonder if Ian has cracked. He doesn't really think this
entire thread is about how he personally works surely? Come on Ian,
please tell us you are trolling here.

No, my point is checking in code with bits commented out is a process
smell. There is no reason what so ever to do it.
 
J

jameskuyper

Nick said:
CBFalconer said:
Eric Sosman wrote:
In another message posted just one minute later
[Richard <null>] wrote:
Collins is being a smart arse again and speaking for the
entire world from his little corner of perfection.
I am amazed at the percentage of his acquaintances who are these
"smart arses". �I have yet to see a valid definition of the breed.

I found only two comments from him about "smart arse". He uses "arse" a
lot, but he varies the adjective. It's one of those words that tends to
accurately describe the user more often than it fits the person it
nominally is referring to.

It's a UKism. An American might use the term "smart ass".
It has connotations of "too clever by half" someone
who is clever (or thinks they are) and likes to
demonstrate the fact in an obnoxious and annoying manner.

I'm well aware of both the meaning and the alternative spelling. I
stand by my statements about those who use the term.
 
D

David Thompson

Many newsreaders can get confused by lines containing "//", and will
sometimes merge them with the following lines. This can make code
using "//" comments very hard to untangle.

I've not seen that one, but at least one version of Outhouse Depress I
used some years back thought //something_no_space should be a URL and
added an http: to it -- even when quoted in a followup IIRC.

Of course quite a lot of code isn't and won't be posted on news, and
so need not care about news restrictions/problems. And if it
unexpectedly is, restyling comments is not that big a deal.

- formerly david.thompson1 || achar(64) || worldnet.att.net
 
R

Richard Nixon

I've not seen that one, but at least one version of Outhouse Depress I
used some years back thought //something_no_space should be a URL and
added an http: to it -- even when quoted in a followup IIRC.

I remember the bad old days of having to post with OE. Even with cutting
and pasting to make it a proper bottompost, there was every manner of
objectionable usenet style with it, and it was *such* a black box.

Dialog and Opera took the place of OE and IE, may they rest in bitbuckets.

Of course quite a lot of code isn't and won't be posted on news, and
so need not care about news restrictions/problems. And if it
unexpectedly is, restyling comments is not that big a deal.


I know that David has mastered many syntaxes and seems to know the IEEE
stuff that exists as a substrate for, for example, C, C++ and Fortran.

I find myself forgetting what the legal comments are in a syntax:

/* ... */ C90
# perl
! fortran 90
// C99
@ dos
c fortran 77
--
Richard Milhous Nixon

Why is it that we rejoice at a birth and grieve at a funeral? It is because
we are not the person involved.
~~ Mark Twain
 

Ask a Question

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.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top