Deutsch   English   Français   Italiano  
<vq7shq$226p3$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Richard Harnden <richard.nospam@gmail.invalid>
Newsgroups: comp.lang.c
Subject: Re: Which code style do you prefer the most?
Date: Tue, 4 Mar 2025 21:49:46 +0000
Organization: A noiseless patient Spider
Lines: 48
Message-ID: <vq7shq$226p3$1@dont-email.me>
References: <vpkmq0$21php$1@dont-email.me>
 <20250304175602.c9fe683d678d3a2ed101a4ac@g{oogle}mail.com>
 <vq75k8$1t6ut$2@dont-email.me> <vq785i$1u7v7$1@dont-email.me>
 <20250304101022.154@kylheku.com>
Reply-To: nospam.harnden@invalid.com
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 04 Mar 2025 22:49:47 +0100 (CET)
Injection-Info: dont-email.me; posting-host="214070166ba35d02c5fead324b98debb";
	logging-data="2169635"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/qY9QRJZ43U2qeWbFLiIK0hDLB08c1I7g="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:2/zvd1ziBWdmcObYRoWIS8QdLMU=
In-Reply-To: <20250304101022.154@kylheku.com>
Content-Language: en-GB
Bytes: 2249

On 04/03/2025 18:14, Kaz Kylheku wrote:
> On 2025-03-04, bart <bc@freeuk.com> wrote:
>> The style I use for generated code is like this:
>>
>>       if (cond) {
>>          stmt1;
>>       }
>>       else {
>>          stmt2;
>>       }
> 
> I've been known to do this:
> 
>    if (case_ineligible_for_switch) {
>      // ...
>    } else switch (state_variable) {
>      // ...
>    }
> 
> or
> 
>    if (case_not_requiring_loop) {
>      // ...
>    } else for (;;) {
>      // ...
>    }
> 
> and I might even have historically perpetrated something like:
> 
>    if (case_not_requiring_loop) {
>      // ...
>    } else if (case_requiring_loop) for (;;) {
>      // ...
>    } else {
>      // ...
>    }
> 
> :)
> 

I like the brace on its own line.  It visually separates the condidition 
from the statement.

How do people format long and complex conditions, given that you're 
trying not to a much over 80 columns?