List:Internals« Previous MessageNext Message »
From:Mark Leith Date:September 24 2010 4:01pm
Subject:Re: [STYLE] could we allow // for comments alone on their line?
View as plain text  
On 24 Sep 2010, at 16:22, Mats Kindahl wrote:

> On 09/24/2010 09:33 AM, Joerg Bruehe wrote:
>> 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.
>>
>
> In this particular case, we would probably be better off if we could
> turn on -std=c89, which disallows C++ comments in C code.
>
> The downside is that it would of course mean that we have to start
> writing standards-compliant C code (oh horrors!). :)
>
>>
>> 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).
>>
>
> I'm used to this comment style for multi-line comments as well and  
> would
> prefer it for the reason you give.


+1

Best regards

Mark

-- 
Mark Leith
Software Development Senior Manager
MySQL Enterprise Tools @ Oracle Corp.

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