Deutsch   English   Français   Italiano  
<vprpss$3ipmu$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: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.lang.c
Subject: Re: Which code style do you prefer the most?
Date: Fri, 28 Feb 2025 08:50:51 +0100
Organization: A noiseless patient Spider
Lines: 80
Message-ID: <vprpss$3ipmu$1@dont-email.me>
References: <vpkmq0$21php$1@dont-email.me> <vpl62m$250af$1@dont-email.me>
 <87frk10w51.fsf@onesoftnet.eu.org> <vpn8vs$2jmv1$1@dont-email.me>
 <vpn92i$86q$1@reader1.panix.com> <vpodnf$2q6ak$4@dont-email.me>
 <vpovd0$30d00$1@dont-email.me> <vpp011$30evb$1@dont-email.me>
 <vpp8ag$31ooi$1@dont-email.me> <vppaeq$323aa$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 28 Feb 2025 08:50:53 +0100 (CET)
Injection-Info: dont-email.me; posting-host="7f1edf13f3a2bd11a154e43fc59f18be";
	logging-data="3761886"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+C2raE7hy3K0+vNB/+caS2"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
Cancel-Lock: sha1:TBYjwBHZYK31yUFimcRdK5S5Bv8=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <vppaeq$323aa$1@dont-email.me>
Bytes: 3817

On 27.02.2025 10:15, Lawrence D'Oliveiro wrote:
> On Thu, 27 Feb 2025 09:38:40 +0100, Janis Papanagnou wrote:
> 
>> Too deep indenting I consider to be a possible bad structuring
>> effect ...
> 
> Would you consider half a dozen indentation levels to be too many? I 
> frequently go that deep.

To be honest, I've never counted them. So why should I suggest someone
else what's a "good" value. Programmers certainly should have got (or
develop) a feeling about what's acceptable and what's too much in their
own playground (or in project contexts where many people cooperate).

But since you were asking I got curious; I pick one recent "C" source
from one of my toy projects and get this distribution of the amount of
indents

   80 -    // empty lines
  169 0
  254 1
  172 2
  122 3
   46 4
   34 5
    7 6
    3 7

What would be your typical indent distribution in your "C" source code?

(I wouldn't expect something completely different, but I also wouldn't
care if there would be.)[*]

Janis

PS: Note that your frequent indents of level 6 would in my setting with
a TAB of four mean 24 colums and would leave (for an 80 column window)
still 56 columns for "C" statements (in case you don't want to pass the
limit).

PPS: In the mentioned toy project I have 849 lines that stay within 80
columns and 38 lines that exceed that limit; the histogram distribution

    N  line length range
  172   1-10
  128  11-20
  106  21-30
   90  31-40
   68  41-50
   51  51-60
  100  61-70
  134  71-80
   28  81-90
    8  91-100
    2 101-110

where the upper range is in more detail sparsely defined by

amount  line length
     ...
    1  91
    3  92
    1  93
    1  94
    1  95
    1  100
    1  101
    1  107

where the longer lines are not complex code but stem from lines with
(long) strings in fprintf() information. Lines with non-printf/string
code are generally of length <90, or even <85 (the one long getopt()
line also has a long string literal, as I got aware).

[*] BTW; my hypothesis is that the actual line length distribution is
depending on the used window sizes. I had observed that folks who use
wide editor windows (or IDEs with wide windows) create wider source
code. I usually use 80 columns editing windows and thus naturally get
an indication when to wrap lines (without actively thinking about it).