| Deutsch English Français Italiano |
|
<875xkvk0gv.fsf@onesoftnet.eu.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Ar Rakin <rakinar2@onesoftnet.eu.org>
Newsgroups: comp.lang.c
Subject: Re: Which code style do you prefer the most?
Date: Thu, 27 Feb 2025 18:59:12 +0600
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <875xkvk0gv.fsf@onesoftnet.eu.org>
References: <vpkmq0$21php$1@dont-email.me> <vpl2k4$24fmt$1@dont-email.me>
<20250225104754.267@kylheku.com> <878qps2abs.fsf@onesoftnet.eu.org>
<vpodu9$2q6ak$5@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 27 Feb 2025 13:59:13 +0100 (CET)
Injection-Info: dont-email.me; posting-host="c3cc10b9b7308b1f47db985a421ccf9c";
logging-data="3281772"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18W2wAZtyncwkXQGSWsjYpf+mnoIRl4A0U="
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:vAVZgkDBFwcFklBPLGjAx/+UxOE=
sha1:Wvksjbqd47XpcwLDB1r/yyRO9dc=
Bytes: 2361
Lawrence D'Oliveiro <ldo@nz.invalid> writes:
> On Wed, 26 Feb 2025 17:51:19 +0600, Ar Rakin wrote:
>
>> I like the GNU style except the weird indentation before the braces of
>> control statements. Not sure why they choose to indent that way.
>
> Just to add to that, I like to *outdent* my “break;” statements at the
> ends of case alternatives:
>
> switch (TheEvent.type)
> {
> case Expose:
> fprintf(stderr, "Expose received\n"); /* debug */
> MainWindowVisible = true;
> /* no drawing done here: just wait until time for next animation frame */
> break;
> case UnmapNotify:
> MainWindowVisible = false; /* I've been iconified */
> break;
> case VisibilityNotify:
> MainWindowVisible = TheEvent.xvisibility.state != VisibilityFullyObscured;
> break;
> case DestroyNotify:
> fprintf(stderr, "Window destroyed\n");
> Quitting = true;
> break;
> default:
> fprintf(stderr, "got event type %d\n", TheEvent.type); /* debug */
> break;
> } /*switch*/
>
> Can anyone guess why? ;)
Probably because it helps you easily understand which part of the code
is inside the case statements. Is that it?