[Info-vax] BASIC (and Horizon)
Arne Vajhøj
arne at vajhoej.dk
Thu Feb 1 18:40:00 EST 2024
On 2/1/2024 8:21 AM, Simon Clubley wrote:
> On 2024-01-31, Dan Cross <cross at spitfire.i.gajendra.net> wrote:
>> I would argue this is more idiomatic, shorter, simpler, easier
>> to both read and to reason about, and uses fewer variables.
>
> I agree and this is the general style I use, but with one difference.
> In my code, I always, always, use braces in an if() statement, even
> if the conditional code is only a single statement. For example:
>
> const bool parsed_ok = PyArg_ParseTuple(args, "Os", &items, &msg);
> if (!parsed_ok)
> {
> return NULL;
> }
>
> I think that makes it more clear and removes any possibility of future
> code changes accidentally not adding the braces at that time.
That is a common coding convention.
Including the original SUN Java coding convention from 1999.
Arne
More information about the Info-vax
mailing list