mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: New docs outline
Date: Thu, 15 Nov 2012 18:36:46 -0500	[thread overview]
Message-ID: <20121115233646.GJ20323@brightrain.aerifal.cx> (raw)
In-Reply-To: <99507C20-19E2-4A14-BD5F-3ECC61A79BF8@gmail.com>

On Thu, Nov 15, 2012 at 02:38:37PM -0800, nwmcsween@gmail.com wrote:
> I would really like a set coding style, currently musl utilizes
> whatever whomever decided to write at the time, usually for pedantic
> things such as parens around sizeof, spacing around operators, etc.

For sizeof, the style is not to use parens on objects, only on types
or expressions where the parens are needed for grouping. This makes it
clear that the size of an object, rather than a type, is being taken.
I believe this is consistent across the source except for some code
like TRE or crypt stuff that was originally written elsewhere and
imported into musl; it was at least intended to be consistent.

For spacing and parens on operators, it's usually done just from a
standpoint of readability -- avoiding too many levels of parens, and
using spacing to help make the grouping obvious. Also to avoid going
past 80 columns or breaking lines (which also hurts readability).

Personally, I feel like this sort of goal/effect-oriented style
guideline is more useful than a strict formatting rule. The latter can
easily be obtained by a machine if desired, but often hurts
readability as much as it helps.

> I also wouldn't mind Linux style function documentation.

I'm not familiar with the convention, but it might be worth adopting.
However, musl doesn't have many functions which are internal-use-only.
Most things are standard interfaces documented in the C or POSIX
standards.

Rich


      reply	other threads:[~2012-11-15 23:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-15 22:20 Rich Felker
2012-11-15 22:38 ` nwmcsween
2012-11-15 23:36   ` Rich Felker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121115233646.GJ20323@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).