Sujet : Re: Which code style do you prefer the most?
De : rakinar2 (at) *nospam* onesoftnet.eu.org (Ar Rakin)
Groupes : comp.lang.cDate : 27. Feb 2025, 14:02:40
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <871pvjk0b3.fsf@onesoftnet.eu.org>
References : 1 2 3 4 5
User-Agent : Gnus/5.13 (Gnus v5.13)
Kaz Kylheku <
643-408-1753@kylheku.com> writes:
On 2025-02-26, Ar Rakin <rakinar2@onesoftnet.eu.org> wrote:
Sorry, I should have showed this difference in my original post. I like
the GNU style except the weird indentation before the braces of control
statements. Not sure why they choose to indent that way.
>
The GNU style without indent before braces looks nice to me.
>
Without the weird brace indent, it has nothing to do with GNU any more; it's
just two-space indentation, where opening braces are on their own line instead
of being "cuddled" into the previous line, which is very common:
>
if (flag)
{
switch (state)
{
case 42:
{
state = 73;
break;
}
}
}
else
{
statement;
}
Well, in the GNU style, function definitions are still different than
other styles which I like:
int
main(int argc, char **argv)
{
printf ("Hello world\n");
return 0;
}
Plus, you can also see how there is a *space* before the open
parenthesis of function call expressions. Many people argue that this
is not a good idea, but I like it.
-- Rakin