bug-make
[Top][All Lists]
Advanced

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

Re: VMS: Exit and exported symbol fixes.


From: Paul Smith
Subject: Re: VMS: Exit and exported symbol fixes.
Date: Wed, 08 Oct 2014 01:17:50 -0400

On Tue, 2014-10-07 at 23:55 -0500, John E. Malmberg wrote:
> $dayjob coding standard is always include braces, but I can follow
> your rules.

There are almost as many C coding standards as there are places that
write C code :-).

However, GNU make follows the GNU coding standards (not my rules!)

http://www.gnu.org/prep/standards/standards.html#Writing-C

I would prefer to keep the code all similar in style, unless there are
good reasons not to (using entire files verbatim from a different
project with different standards for example).

> > Return types should come on the previous line, and function opening
> > braces should be on the next line in the first column of the next
> line,
> > plus whitespace between the name and open paren, like this:
> >
> >    void
> >    vms_exit (int status)
> >    {
> 
> I see the braces indented 2 spaces for most of the code.

Yes, they always are except for at the beginning of functions (opening
function braces are always in column 1) and "bare blocks", used for
scoping variables.  This use is not discussed in the standard but
throughout GNU make I leave the open brace aligned with the previous
line and indent the contents 2 spaces:

void
function (some *ptr)
{
  if (foo)
    bar ();

  if (biz)
    {
      baz ();
      boz ();
    }

  {
    char *foo = get_foo (ptr);
    submit (foo);
  }
}

Cheers!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]