On Wed, Jan 30, 2019 at 1:30 AM Karl Tomlinson <mozn...@karlt.net> wrote:

> Ehsan Akhgari writes:
>
> > On Mon, Jan 28, 2019 at 6:27 PM Ryan Hunt <rh...@eqrion.net> wrote:
> >
> >> [...]
> >>
> >> So for converting from C-style to C++-style, that would be:
> >>
> >> /* static */ void Foo::Bar() {
> >>  ...
> >> }
> >>
> >> // static
> >> void Foo::Bar() {
> >>  ...
> >> }
> >>
> >> [...]
> >>
> >> My one concern would be the presence of other C++-style
> >> comments before the method definition. For example [1].
> >
> > [...]  How about detecting those cases and inserting a newline
> > between the comments on the line before, for extra clarity?
> >
> >> [...]
> >>
> >> [1]
> >>
> https://hg.mozilla.org/mozilla-central/file/e4b9b1084292/layout/generic/nsFrame.cpp#l1023
> >>
> >> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> >> On Monday, January 28, 2019 12:51 PM, Ehsan Akhgari <
> >> ehsan.akhg...@gmail.com> wrote:
> >>
> >> [...]
> >>
> >> The path to least resistance for addressing this problem may be to
> convert
> >> these into C++-style comments and therefore moving them into their own
> >> lines.  Would you be OK with that?
>
> I haven't noticed clang-format enforcing its own opinions on
> comments when they already follow Google style.
>
> In my experiments clang-format is accepting this:
>
> // Make this Foo Bar.
> /* static */
> void Foo::Bar() {
>  ...
> }
>
> The /* */ style comment provides a clear separation from any other
> comment on the previous line, without the need for an extra
> blank-line.  "don't use blank lines when you don't have to."
>

It depends on where you start from.  If you start from the code sample
above, clang-format won't touch the lines with comments.  However if you
start from the code sample below, it will:

// Make this Foo Bar.
/* static */ void
Foo::Bar()
{
  // ...
}

It will get reformatted to:

// Make this Foo Bar.
/* static */ void Foo::Bar() {
  // ...
}

Cheers,
-- 
Ehsan
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to