[TUHS] // comment in C++

Dave Horsfall dave at horsfall.org
Thu Feb 9 09:52:30 AEST 2017

On Wed, 8 Feb 2017, Steve Johnson wrote:

> I remember some discussion about this.  In reality, a C comment really 
> requires you to type 8 characters, because putting anything adjacent to 
> the /* or */ looks terrible.  Many languages used single characters 
> (e.g., # for make).  The argument was "if you make comments easier to 
> type, you'll get more of them in the code"  (viz. the Unix kernel).  I'm 
> guessing Bjarne was aware of these discussions, although I don't 
> remember specifically that he was...

My favourite C /* */ style is this:

 * foo
 * bar

Is that what you meant?  And recent C also accepts // as a comment, which 
I use like this:

     * This is where we do some neat stuff.
    weird_function();	// Yes, we need to call this here...

I'm quite taken by BIND, though, which accepts

/* this */
// this
# and this.

Dave Horsfall DTM (VK2KFU)  "Those who don't understand security will suffer."

More information about the TUHS mailing list