List:Internals« Previous MessageNext Message »
From:Joerg Bruehe Date:September 24 2010 7:33am
Subject:Re: [STYLE] could we allow // for comments alone on their line?
View as plain text  
Hi Guilhem, all!


To me, your question has both a style and a technical aspect.

Guilhem Bichot wrote:
> [[...]]
> 
> So the proposal is merely to allow
> // this is a comment which is alone on its line
> in C++ code.
> I'm fine if we continue forbidding
> // this is
> // a multi-line
> // comment
> and require /* */ instead.
> 

My technical comment on "//":

The increased use of "//" comments in C++ files raises the risk of using
them in C files, which will not be rejected by most C compilers
(including gcc) but will cause compilation failures with IBM C (which we
use on AIX and i5/os).

We have had several release builds fail because of this, it is simply
detected too late. So the build team has to fix it, push, and start a
rebuild. Considering that AIX and i5os are not our fastest platforms and
that we might not detect the failure immediately, the delay may be
significant.

I would prefer not to use "//" at all, just to avoid that it might
become a habit which then affects C files.


My style comment (includes technical reasoning):

For multi-line comments, my preference would be
   /*
    * the real comment
    * maybe several lines
    */
so that a commented code line returned by "grep" does not look like
active code. (I have been bitten several times by this when checking
MySQL code: a variable looked like being used when in fact all use was
already turned into comments.)
However, this style differs from current MySQL conventions so I will not
pursue this myself (but would support others who feel similar).


Regards,
Jörg

-- 
Joerg Bruehe,  MySQL Build Team,  joerg.bruehe@stripped
               (+49 30) 417 01 487
ORACLE Deutschland B.V. & Co. KG,   Komturstrasse 18a,   D-12099 Berlin
Geschaeftsfuehrer: Juergen Kunz, Marcel v.d. Molen, Alexander v.d. Ven
Amtsgericht Muenchen: HRA 95603

Thread
[STYLE] could we allow // for comments alone on their line?Guilhem Bichot23 Sep
  • Re: [STYLE] could we allow // for comments alone on their line?Joerg Bruehe24 Sep
    • Re: [STYLE] could we allow // for comments alone on their line?Mats Kindahl24 Sep
      • Re: [STYLE] could we allow // for comments alone on their line?Mark Leith24 Sep
      • Re: [STYLE] could we allow // for comments alone on their line?Davi Arnaut25 Sep
        • Re: [STYLE] could we allow // for comments alone on their line?Mats Kindahl25 Sep
          • Re: [STYLE] could we allow // for comments alone on their line?Davi Arnaut26 Sep
        • Re: [STYLE] could we allow // for comments alone on their line?Guilhem Bichot27 Sep
          • Re: [STYLE] could we allow // for comments alone on their line?Martin Hansson28 Sep
          • Re: [STYLE] could we allow // for comments alone on their line?Davi Arnaut28 Sep
  • Re: [STYLE] could we allow // for comments alone on their line?Ingo Struewing24 Sep
  • [STYLE] could we allow // for comments alone on their line?Michael Widenius30 Sep