Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #68419

Re: Quick Question

From James Kuyper <jameskuyper@verizon.net>
Newsgroups comp.lang.c
Subject Re: Quick Question
Date 2015-08-26 10:23 -0400
Organization A noiseless patient Spider
Message-ID <mrki29$9l9$1@dont-email.me> (permalink)
References <67823de8-55d1-4b17-bd06-c50c95410766@googlegroups.com> <mrja0q$ba2$1@dont-email.me> <HTcDx.358368$LU5.217553@fx12.am4> <mrk6lv$umk$1@dont-email.me> <UUhDx.263593$XD2.34415@fx01.am4>

Show all headers | View raw


On 08/26/2015 08:01 AM, Richard Heathfield wrote:
...
> yes, of course it's Microsoft's fault. But it's partly Dennis Ritchie's 
> fault. "C" is the worst thing about C. If he'd called it "dritchie" or 
> "dmrlang" or "flodge", that would have been far better. Those are all 
> terrible names for programming languages, but they're all better than "C".

My first programming language was Fortran I (sic), and I had to use my
error-prone fingers to keypunch the cards my programs were written on,
so I tried to write my programs so they involved as little typing as
possible. [I'm not quite as old as that makes me sound - an alumnus
donated a long-obsolete IBM 1620 to my high school, so I was learning
programming in the late 1970's, not the 1960's]. Therefore, I got into
the habit of using i, j, k, etc for loop counters. It took me decades to
realize that I was making things difficult for myself, because
single-character names are hard to search for. I now have a strict rule
of never defining an identifier with fewer than 3 characters. It's much
easier to confirm the validity of the following code than equivalent
code using i and j:

// ECI: Earth Centered Inertial coordinates
// ECR: Earth Centered Rotating coordinates.
	for(int eci=0; eci<3; eci++)
        {
	     pos_eci[eci] = 0;
	     for(int ecr=0; ecr<3; ecr++)
                 pos_eci[eci] += ecr2eci[eci][ecr] * pos_ecr[ecr];
	}

Note: we use a naming convention for rotation matrices such that, when
using loop counters named this way, a2b[b][a] is always the only correct
way to index a2b. Before I introduced this convention, incorrectly
indexed rotation matrices were very common in the body of code I was
working on - we had no real data to test with at that time, and the
simulated data we were using could easily have been created by code
containing the same mistake, rendering it indetectible.
-- 
James Kuyper

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Quick Question dougmmika@gmail.com - 2015-08-25 19:22 -0700
  Re: Quick Question "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-25 19:24 -0700
  Re: Quick Question James Kuyper <jameskuyper@verizon.net> - 2015-08-25 23:00 -0400
    Re: Quick Question Richard Heathfield <rjh@cpax.org.uk> - 2015-08-26 07:19 +0100
      Re: Quick Question glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-26 07:55 +0000
        Re: Quick Question "Osmium" <r124c4u102@comcast.net> - 2015-08-26 06:04 -0500
          Re: Quick Question Richard Heathfield <rjh@cpax.org.uk> - 2015-08-26 12:58 +0100
            Re: Quick Question "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-08-26 05:20 -0700
          Re: Quick Question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-26 13:17 +0100
            Re: Quick Question "Osmium" <r124c4u102@comcast.net> - 2015-08-26 08:15 -0500
          Re: Quick Question Keith Thompson <kst-u@mib.org> - 2015-08-26 08:36 -0700
      Re: Quick Question David Brown <david.brown@hesbynett.no> - 2015-08-26 13:09 +0200
        Re: Quick Question Richard Heathfield <rjh@cpax.org.uk> - 2015-08-26 13:01 +0100
          Re: Quick Question David Brown <david.brown@hesbynett.no> - 2015-08-26 14:30 +0200
          Re: Quick Question Lowell Gilbert <lgusenet@be-well.ilk.org> - 2015-08-26 09:14 -0400
            Re: Quick Question Ken Brody <kenbrody@spamcop.net> - 2015-08-26 13:40 -0400
          Re: Quick Question James Kuyper <jameskuyper@verizon.net> - 2015-08-26 10:23 -0400
          Re: Quick Question Keith Thompson <kst-u@mib.org> - 2015-08-26 08:39 -0700
            Re: Quick Question Ken Brody <kenbrody@spamcop.net> - 2015-08-26 13:43 -0400
            Re: Quick Question Keith Thompson <kst-u@mib.org> - 2015-08-27 09:26 -0700
          Re: Quick Question Ken Brody <kenbrody@spamcop.net> - 2015-08-26 13:39 -0400
            Re: Quick Question Bartc <bc@freeuk.com> - 2015-08-26 18:46 +0100
            Re: Quick Question James Kuyper <jameskuyper@verizon.net> - 2015-08-26 14:08 -0400
            Re: Quick Question Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-26 22:41 -0700
              Re: Quick Question Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2015-08-27 08:40 -0600
                Re: Quick Question Paul N <gw7rib@aol.com> - 2015-08-27 13:49 -0700
                Re: Quick Question Keith Thompson <kst-u@mib.org> - 2015-08-27 14:28 -0700
        Re: Quick Question James Kuyper <jameskuyper@verizon.net> - 2015-08-26 10:24 -0400

csiph-web