
On Jan 19, 2016, at 08:56, Jim J. Jewett <jimjjewett@gmail.com> wrote:
On Mon Jan 18 03:39:42 EST 2016, Andrew Barnert pointed out:
Alternatively, it could say something like "braces must not be omitted; when other C styles would use a braceless one-liner, a one-liner with braces should be used instead; otherwise, they should be formatted as follows"
That "otherwise" gets a bit awkward, but I like the idea. Perhaps "braces must not be omitted, and should normally be formatted as follows. ... Where other C styles would permit a braceless one-liner, the expression and braces may be moved to a single line, as follows: "
if (x > 5) { y++ }
I think that is clearly better, but it may be *too* lightweight for flow control.
if (!obj) { return -1; }
does work for me, and I think the \n{} may actually be useful for warning that flow control takes a jump.
Your wording is much better than mine. And so is your suggestion. Giving people the option of 1 or 3 lines, but not 2, seems a little silly. And, while I rarely use or see your 2-line version in C, I use it quite a bit in C++ (and related languages like D), so it doesn't look at all weird to me. But I'll leave it up to people who only do C (and Python) and/or who are more familiar with the CPython code base to judge.