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
> 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.
Just my few cents,