Sujet : Re: how to make a macro work as a single line if stmt without braces
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 30. Sep 2024, 00:39:31
Autres entêtes
Organisation : None to speak of
Message-ID : <87o746qbbg.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7
User-Agent : Gnus/5.13 (Gnus v5.13)
Andrey Tarasevich <
andreytarasevich@hotmail.com> writes:
[...]
This is unreadable and unacceptable
>
if (condition) {
whatever1; /* <-- Bad! No vertical separation! */
whatever2;
}
>
for (abc; def; ghi) {
whatever1; /* <-- Bad! No vertical separation! */
whatever2;
}
>
This is _immensely_ more readable
>
if (condition)
{ /* <-- Good! Vertical space */
whatever1;
whatever2;
}
>
for (abc; def; fgh)
{ /* <-- Good! Vertical space */
whatever1;
whatever2;
}
[...]
Andrey, I hope you're aware that you're stating your own personal
preferences as if they were incontrovertible fact.
Readability is a combination of the text being read and the person
reading it. I accept without question that *you* find K&R-style
brace placement "unreadable and unacceptable". A lot of experienced
C programmers, myself included, either prefer the K&R style or
find both styles more or less equally readable. And many prefer
vertically aligned braces but can deal with K&R-style braces.
I have some quirks of my own, things that most people accept but
I hate, so I get where you're coming from. But I suggest it would
be good for you to be aware that your preferences are something of
an outlier, and that arguing about it isn't going to be productive.
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */