| Deutsch English Français Italiano |
|
<m2vsi3FibmlU1@mid.individual.net> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: G <g@nowhere.invalid>
Newsgroups: comp.lang.c
Subject: Re: Which code style do you prefer the most?
Date: 7 Mar 2025 09:28:35 GMT
Organization: <Not Here, Not Me>
Lines: 56
Sender: Gip <gip@G15.fritz.box>
Message-ID: <m2vsi3FibmlU1@mid.individual.net>
References: <vpkmq0$21php$1@dont-email.me> <vq7shq$226p3$1@dont-email.me> <vq7u5u$21gol$2@dont-email.me> <20250305152224.ea400cb92445c78f6a4ba523@g{oogle}mail.com> <vq9kf0$2efj9$1@dont-email.me> <vq9mkb$2erto$1@dont-email.me> <20250305183051.3cca469a0fd757595152b261@g{oogle}mail.com> <vq9uqh$2g9q3$1@dont-email.me> <vqa0gr$2gmc7$1@dont-email.me> <vqa1rq$2gr5h$1@dont-email.me> <Ea0yP.6763$SVG3.6427@fx42.iad> <vqbptn$2triu$1@dont-email.me> <WBiyP.170259$BrX.10828@fx12.iad> <vqctf7$33v5m$1@dont-email.me>
X-Trace: individual.net RvPJtwUHcSzGFOjNEnkDswVK7LJjbWO6beUD4CDO7oYRsNWw28
X-Orig-Path: not-for-mail
Cancel-Lock: sha1:/oLbNzJv0Q/MhBHS9ovOhm4LHmM= sha256:uW+T8Oy6+hTibMS7XmF8dX3mRTnDye6XA+MVYUwg1/c=
User-Agent: tin/2.6.4-20241224 ("Helmsdale") (Linux/6.13.5-200.fc41.x86_64 (x86_64))
Bytes: 3670
David Brown <david.brown@hesbynett.no> wrote:
> On 06/03/2025 15:49, Scott Lurndal wrote:
>> David Brown <david.brown@hesbynett.no> writes:
>>> On 05/03/2025 18:51, Scott Lurndal wrote:
>>>> Richard Harnden <richard.nospam@gmail.invalid> writes:
>>>>> On 05/03/2025 17:09, Janis Papanagnou wrote:
>>>>>> On 05.03.2025 17:40, bart wrote:
>>>>>>> [...]
>>>>
>>>>>
>>>>> Seriously, short variable names for common things - i, j, k for loop
>>>>> counters;
>>>>
>>>> So, one might ask _why_ i, j, k instead of a, b, c?
>>>>
>>>> Answer: Fortran IMPLICIT INTEGER
>>>>
>>>
>>> Nonsense.
>>>
>>> Ask rather why Fortran picked i, j, k for integer-type index variables.
>>> Their use for that function in maths /long/ predates Fortran.
>>
>> That doesn't mean that C programmers didn't adopt the
>> use of i,j,k from FORTRAN.
>
> I certainly did not. I use i, j, k in maths, then in BASIC, then in
> Pascal, then in C. No Fortran in sight.
>
> /Everyone/ uses i, j, k for simple indices, because it is standard in
> maths and is a convention that works well in just about any programming
> language. Fortran may have been have been one of the first high-level
> programming languages, but there is no reason to suppose others copied
> this convention from it.
>
> And while my knowledge of Fortran is close to negligible, I don't
> believe you are /required/ to use i, j or k for indices - people use
> other letters or identifiers for loop counters and indices, just as they
> do in most languages. The only language I know of where you are forced
> to use i and j is FORTH.
>
> I'm sure that people who first programmed in Fortran, and then in C,
> took some of their habits with them. And there are no doubt plenty of
> features of programming and programming languages that Fortran
> pioneered, and other languages copied - this is not one of them.
When I was programming in FORTRAN i thought that the fact that "i" to "n"
where implicitly integer where because they where the initials of "Integer
Number", probably a coincidence... but useful to remember it.
And that was before I learned that the first instruction in any FORTRAN
program has to be "IMPLICIT NONE", it took almost a day to debug a program
when I mistakenly wrote "I0UT" instead of "IOUT" using a terminal where "O"
and "0" where almost identical, the FORTRAN compiler happily accepted it,the
program not so much.
G