home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!spool.mu.edu!umn.edu!csus.edu!netcom.com!pdh
- From: pdh@netcom.com (Phil Howard )
- Subject: readable code
- Message-ID: <1992Dec31.020953.12265@netcom.com>
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
- Date: Thu, 31 Dec 1992 02:09:53 GMT
- Lines: 52
-
- I just saw a posting on comp.lang.c on the usage of ?: and one of the
- replies noted that you could use ?: to select the choice of function
- to be called with one set of argument list.
-
- C has a lot of features other languages just don't have. In those endless
- debates over what language is best, a lot of people frequently tell me that
- certain features (and they happen to point out the ones C has that others
- do not) are "not (easily) readable".
-
- In one debate I had, someone tried to convince me that:
-
- x += 3;
-
- was not readable while:
-
- x = x + 3;
-
- was readable.
-
- To me, an expression like:
-
- ( ( n < midway ) ? array_a : array_b ) [ n ] += k;
-
- is perfectly readable.
-
- What I am interested in finding out is what is a good way to specifically
- characterize CODE READABILITY (specific to the C language).
-
- I think we should assume readability by a fully experienced C programmer.
- Just because something does not exist in other languages or fields of
- study does not, IMHO, justify attacking it as unreadable WITHIN the C
- language, so I am not interested in that aspect of the question.
-
- BTW, I've had a couple people who I know are fully experienced C programmers
- tell me that they find array subscripting like:
-
- array [ n ]
-
- harder to read, and insist on something like:
-
- array[n]
-
- Personally I find the former easier to read, PROVIDED IT FITS. There is
- not that much difference that I would not squish it to get certain things
- on one line where those things would read better that way. But I do feel
- I should space things out when it makes it easier to read... it it usually
- does so for *ME*.
- --
- /************************************************************************\
- | Phil Howard, pdh@netcom.com, KA9WGN Spell protection? "1(911)A1" |
- | "It's not broken... it's just functionally challenged" --Phil and Pete |
- \************************************************************************/
-