fast code and no morals

rex ballard rb at ccivax.UUCP
Sat Feb 1 12:26:48 AEST 1986


In article <489 at zinfandel.UUCP> berry at zinfandel.UUCP (Berry Kercheval) writes:
> [very bizarre code involving switches]
>I think I'll name it after myself -- ``Duff's Device'' has a nice ring to it.
>
>It amazes me that after 10 years of writing C there are still little corners
>that I haven't explored fully.  (Actually, I have another revolting way to
>use switches to implement interrupt driven state machines but it's too
>horrid to go into.)
>
>Tom Duff {ucbvax,decvax,ihnp4,...}!alice!td

Sounds kinky, I'd love to see it.

There is a point where 'Religion in Languages' is detremental.  Sure, if
a compiler/machine can produce better code in 'Structured C' than in
'Kludge C', that's great!  I know of only one machine where this is even
close to the case!  Other-wise, there are a few folks writing code for
controllers and things, that needs to be FAST, on a CPU that thinks
a call is an 'invitation to an interrupt'.

Tricks like quick-switches, and even 'function returning pointer to funtion...'
are very necessary.  For a good tutorial in 'Kludge C' look at the source
to Unix (Version 6 is particularly cute).



More information about the Comp.lang.c mailing list