tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [patch] C99 & /usr/share/misc/style



On Thu, Dec 29, 2022 at 20:11:43 -0500, Greg Troxel wrote:

> Joseph Koshy <jkoshy%netbsd.org@localhost> writes:
> 
> > +// C99 single-line comments are allowed.
> > +
> > +// C99 single-line comments can also be used to write longer form
> > +// comments.  Fill these so they look like real paragraphs.
> > +
> >  /*
> >   * Attempt to wrap lines longer than 80 characters appropriately.
> >   * Refer to the examples below for more information.
> 
> 
> I don't like this.  This is C++ creeping into C, and the kernel has been
> C forever (well early 70s).  But more seriously, there is currently one
> way to write comments, and having both C and C++ comments is a mess as
> it will be inconsistent, which is just bad style before you even talk
> about code.  I don't think anyone wants to mass edit /* to //.

I don't think this is what is being proposed (cf. "allowed").

Given 80 character width limit and (imho - ridiculously large :) 8
column indent, we are kinda starved on space, so a traling // comment
at the end of a line saves 3 characters (" */").

I'm not a big fan of column-0 // comments, b/c they tend to be less
visually distinct w.r.t. to the stuff that follows.  I.e. I find this:

/*
 * This is a function that does some interesting stuff.  Please see
 * also some other function that is its counterpart
 */
int
foo()
{ ...
}

To be more readable than this:

// This is a function that does some interesting stuff.  Please see
// also some other function that is its counterpart
int
foo()
{ ...
}

and in this case // doesn't provide any width savings either.

This tends to flip for indented multiline comments, where /**/ stand
out too much for me.

I think "allowed" plus some taste and common sense (which you cannot
legalize no matter how you try) can go a long way :).


-uwe


Home | Main Index | Thread Index | Old Index