Sujet : Re: The joy of FORTRAN
De : c186282 (at) *nospam* nnada.net (c186282)
Groupes : alt.folklore.computers comp.os.linux.miscDate : 02. Mar 2025, 06:17:39
Autres entêtes
Message-ID : <V82cnbblIbFrdF76nZ2dnZfqn_udnZ2d@giganews.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0
On 3/1/25 4:25 AM, The Natural Philosopher wrote:
On 01/03/2025 01:24, c186282 wrote:
Being kinda old-school my pgms always look like
something from the K&R book, and with comments
after almost every line. THAT you can read a
day from now, or a year from now ....
Yes.Even the ? operator gets clumsy if it is being used to fork two different paths of complex code.
Much better to use an 'If' with some long blocks, or even inline function for clarity and still retain the speed.
Esp with 'C', it's DIFFICULT to keep it READABLE.
Difficult to make sure even YOU can understand
how it works in a day, a week, a year.
The K&R look and feel is pretty good for that.
Alas the lang makes it possible to completely
ruin that approach - and many DO, just because
they can, makes 'em look more clever.
But the code doesn't REALLY compile/run much faster.
SAME underlying STUFF being done regardless.
So :
if(x>y)
{
.....
}
else
{
.....
}
I pref to not put the leading bracket on the
same line as the 'if' or 'else' because then
it's easier to pick out the block by eye -
just look for the '{' on the left.