[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#41061: [PATCH] cc-mode: add ‘c-lineup-ternary-bodies’
From: |
Michał Nazarewicz |
Subject: |
bug#41061: [PATCH] cc-mode: add ‘c-lineup-ternary-bodies’ |
Date: |
Mon, 4 May 2020 21:00:06 +0100 |
On Mon, 4 May 2020 at 04:17, Richard Stallman <rms@gnu.org> wrote:
> > return arg % 2 == 0 ? arg / 2
> > : (3 * arg + 1);
>
> You can format the code that way if you like,
It’s more that project I’m involved in enforces such style.
It’s one of the alignments clang-format supports so I’m likely
not the only person who needs to conform to this particular
style.
> but the GNU convention is like this:
>
> return (arg % 2 == 0
> ? arg / 2
> : 3 * arg + 1);
>
> That not only makes the nesting very clear,
> it also indents correctly without a special hack.
--
Best regards
ミハウ “𝓶𝓲𝓷𝓪86” ナザレヴイツ
«If at first you don’t succeed, give up skydiving»