From: Stephen Satchell <satch@fluent-access.com>
To: Steve Underwood <steveu@coppice.org>,
Linux Kernel List <linux-kernel@vger.kernel.org>
Subject: Re: [OT?] Coding Style
Date: Tue, 23 Jan 2001 10:10:34 -0800 [thread overview]
Message-ID: <4.3.2.7.2.20010123094723.00b192c0@mail.fluent-access.com> (raw)
In-Reply-To: <3A6D78EA.5B09C379@coppice.org>
In-Reply-To: <28560036253BD41191A10000F8BCBD116BDCC5@zcard00g.ca.nortel.com> <20010122082254.D9530@work.bitmover.com>
At 08:28 PM 1/23/01 +0800, Steve Underwood wrote:
>During a period of making a liveing out of
>sorting out severly screwed up projects I made a little comment
>stripper. I found comments so unreliable, and so seldom useful, I was
>better off reading the code without the confusion they might cause. I
>do, however, try to document the non-obvious through comments in what I
>write.
Ditto. Mine had the option of leaving the block comments in place (line
count was a parameter) because the block comments proved to be more useful
than the in-line comments.
>Some people still seem to be living in the age of K&R C, with 6 or 7
>character variable names that demand some explanation. Maybe some day
>they will awake to the expressive power of long (and well chosen) names.
Actually, they are still living as though the KSR-33 and ASR-33 teletypes
were the only input device. :)
True story: I was retained to solve a particular problem for a company
over a one-year time period. I wrote some rather nifty code to solve the
problem, and was happily doing data extraction and conversion for that time
period. Then there was a management turnover at the client and the new guy
decided to implement a cost-cutting measure: cut out as many outsiders as
possible. He decided that I should give him the code I had developed over
the year (that wasn't part of the contract, of course) so that he could
have in-house people do it. Not just executable programs, of course. "We
bought the development of that code, so we deserve the source." The
bastard backed up the demand with his lawyer. Not wanting to spend the
money on the threatened lawsuit, I gave him exactly what he asked for: the
source to the latest working version of the programs I wrote to do the job.
It took a while to prepare the source for this jerk. Here is what I did to
the source I gave the guy:
1) Used the output of CPP, which stripped out all include files and strips
all comments. This had the interesting side effect of making the source
compiler-dependent.
2) Stripped all newlines, and converted strings of spaces and tabs not in
quotes to a single space. This made the source one line long...a VERY LONG
line.
3) Converted each reasonable variable name to a string of seven random
characters from the set [A-Aa-z0-9_], with the first character restricted
to [A-Za-z]. A list of #define statements equated the random name to the
proper library name or symbol. (Because the names included a number of
internal variables in the compiler library, this was a HUGE list.) The
resulting symbol table was so large that I had to use disk to keep all the
names. Inadvertently I had also randomized lexical elements such as "for",
"while" and so forth, but #define statements took care of that problem.
4) Determined that the output of the compiler with the mangled source was
exactly the same as the output of the compiler with the original source.
As you can guess, I discovered a few bugs with the compiler I was
using. The compiler writer (who was just down the road) was highly amused
with this and asked if they could "borrow" my mangler "for test
purposes." (Just who do they think they were kiddin'?)
Satch
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2001-01-23 18:11 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-22 16:04 [OT?] Coding Style Jonathan Earle
2001-01-22 16:19 ` Mike Harrold
2001-01-22 16:22 ` Larry McVoy
2001-01-22 18:29 ` Richard B. Johnson
2001-01-22 23:20 ` Admin Mailing Lists
2001-01-23 0:54 ` Werner Almesberger
2001-01-23 12:28 ` Steve Underwood
2001-01-23 16:17 ` Nicolas Noble
2001-01-23 21:16 ` David Benfell
2001-01-23 12:52 ` Andrew Morton
2001-01-23 18:10 ` Stephen Satchell [this message]
2001-01-22 17:43 ` Gregory Maxwell
-- strict thread matches above, loose matches on Subject: below --
2001-01-23 22:22 Jonathan Earle
2001-01-23 16:47 Jesse Pollard
2001-01-24 0:07 ` Stephen Satchell
2001-01-23 15:41 Jonathan Earle
2001-01-23 15:58 ` Larry McVoy
2001-01-23 16:00 ` Mike Harrold
2001-01-23 16:32 ` Joe deBlaquiere
2001-01-24 1:14 ` Steve Underwood
2001-01-25 13:33 ` Kai Henningsen
2001-01-24 5:42 ` Brent Rowland
2001-01-24 5:50 ` Andre Hedrick
2001-01-26 0:20 ` James Stevenson
2001-01-23 16:14 ` Georg Nikodym
2001-01-23 18:05 ` Christopher Friesen
2001-01-23 18:41 ` Mathieu Chouquet-Stringer
2001-01-23 18:44 ` Georg Nikodym
2001-01-23 18:53 ` James Kelly
2001-01-23 17:42 ` John Kodis
2001-01-25 13:38 ` Kai Henningsen
2001-01-25 13:25 ` Kai Henningsen
2001-01-25 19:30 ` Harald Arnesen
2001-01-22 21:09 Stephen Satchell
2001-01-22 16:42 ` Mark I Manning IV
2001-01-22 23:56 ` Anton Altaparmakov
2001-01-23 0:01 ` Larry McVoy
2001-01-23 6:37 ` Stephen Satchell
2001-01-23 8:37 ` Helge Hafting
2001-01-23 18:58 ` Alan Olsen
2001-01-22 17:53 Jonathan Earle
2001-01-20 15:32 Anton Altaparmakov
2001-01-20 16:19 ` [OT?] " profmakx.fmp
2001-01-21 5:10 ` Ragnar Hojland Espinosa
2001-01-21 5:50 ` Admin Mailing Lists
2001-01-21 5:58 ` Mike A. Harris
2001-01-21 7:07 ` Josh Myer
2001-01-21 7:20 ` Alan Olsen
2001-01-21 22:40 ` Mo McKinlay
2001-01-22 0:23 ` Admin Mailing Lists
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4.3.2.7.2.20010123094723.00b192c0@mail.fluent-access.com \
--to=satch@fluent-access.com \
--cc=linux-kernel@vger.kernel.org \
--cc=steveu@coppice.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).