From: Martin Gebert <Murphy.Gebert-Mmb7MZpHnFY@public.gmane.org>
To: "Michael Kerrisk (man-pages)"
<mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Keith Thompson
<keithsthompson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Keith Thompson
<Keith.S.Thompson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: backtrace(3): Inconsistency and missing indentation
Date: Fri, 26 Feb 2016 22:08:13 +0100 [thread overview]
Message-ID: <56D0BEBD.50908@gmx.de> (raw)
In-Reply-To: <56D0B704.8050001-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Hi Keith!
> I suggest leaving it as it was, apart from using SIZE in the definition > of buffer. > > It's common for preprocessor directives to be
left-justified rather > than aligned with the surrounding code. (They
mostly appear at file > scope, so it's not usually an issue.) It's
perfectly valid to indent > the #define, but it's a bit misleading,
since it implies that SIZE has > a scope (it doesn't, it's visible to
the end of the translation unit).
While I agree with you concerning the scope, I would then expect the
SIZE macro be placed between the includes and the function header, as
everything that has not a block scope. It just seems misplaced in the
middle of the function (more exactly between the variable definitions),
but outdented.
More generally, if somebody wants to make clear that a macro has only
meaning in the local block I would prefer to place it there, but indent
it with the rest of the code. If it's supposed to be used file-wide I
would expect it before the first function, but without indention. IMHO
the given code snippet is a wild mix that caught my eye as being quite
unpleasing and unintuitive. So I suggest doing it the one /or/ the other
way; I would've preferred Michael's solution in the first place, but
obviously that's not universal enough for a man page.
And as a disclaimer, that's my built-in, intuitive style guide speaking,
as I'm by no means an authority of C code formatting.
Cheers,
Martin
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-02-26 21:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-24 9:26 backtrace(3): Inconsistency and missing indentation Martin Gebert
[not found] ` <56CD772C.8030606-Mmb7MZpHnFY@public.gmane.org>
2016-02-26 15:46 ` Michael Kerrisk (man-pages)
[not found] ` <56D07349.10901-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-02-26 19:52 ` Keith Thompson
[not found] ` <CAAHpriNbkVCsH-mrVi97Y57ahw=6yO=kh+C7OuLzfQXrJiJO-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-02-26 20:35 ` Michael Kerrisk (man-pages)
[not found] ` <56D0B704.8050001-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-02-26 20:41 ` Keith Thompson
2016-02-26 21:08 ` Martin Gebert [this message]
[not found] ` <56D0BEBD.50908-Mmb7MZpHnFY@public.gmane.org>
2016-02-28 19:21 ` Michael Kerrisk (man-pages)
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=56D0BEBD.50908@gmx.de \
--to=murphy.gebert-mmb7mzphnfy@public.gmane.org \
--cc=Keith.S.Thompson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=keithsthompson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/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.
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).