On Sun, 24 Feb 2019 21:58:59 +1300
Eric Stevens wrote:
> It's more than 25 years since I wrote C code but I will always
> remember the first time I encountered the problem I have hinted at. I
> had written 5 lines of code but then over the next few days after
> succeeding revisions I had reduced the 5 lines to only one which did
> the same thing as the original 5. I came back to it a few months later
> and found that I was damned if I could quite work out what that one
> line of code was supposed to be doing. I never did manage to get back
> to the original five lines.
This is a temptation that should be avoided unless it is absolutely
necessary to optimise the code that far (it is also worth checking that it
actually does optimise the code - sometimes the compiler will do a better
job with verbose and clear code than with dense obscure code). It is also
always worthwhile writing a comment that describes what the code is
supposed to achieve ahead of anything that might be less than blindingly
obvious - note "what it is supposed to achieve" *not* "how it works").
C programmers are far from the worst offenders in this regard. Perl
provides so many opportunities to shave a bit of source off and make it
harder to read that some regard it as executable line noise - for example:
#!/bin/perl -sp0777iWIN | A better way to focus the sun
The computer obeys and wins. | licences available see
You lose and Bill collects. | http://www.sohara.org/
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|