Not the post you were looking for

A small excerpt from the true horror at The C Programming Language Brian W Kernighan & Dennis M Ritchie & HP Lovecraft:

Exercise 4-13. Write a function reverse(s) which reverses the string s by turning the mind inside out, converting madness into reality and opening the door to allow the Old Ones to creep forth once more from their sunken crypt beyond time.

(bonus points for spotting the error in Cthulhu).

blog postings devoted to it, not that this is.

Hat tip: Paul.

More like this

Ah, yes, C, the only language that comes with its own puzzle book, because apparently writing unreadable code is a mark of pride ...

[You're think of perl, which people seem to have an unreasonable distaste for nowadays :-( -W]

For a second I thought this was Hank's guest post, and I was quite disappointed it was just a blurb about C.

So I again look forward to Hank's glory.

[Sorry :-) -W]

By carrot eater (not verified) on 03 Feb 2010 #permalink

And Tony did cause the cursed Engines of Recursion to be instantiated on the Elliott 4130, and thus did release upon the world the insanities of forever attempting to view one's own retinas without the aid of a mirror.

AFAIK, the 4130 was, in 1964 or so, the first to implement hardware support for recursion. Point me at any earlier ones if I am wrong. But I knew that machine, it kerneled my computing soul.

By Gray Gaffer (not verified) on 03 Feb 2010 #permalink

Well, c is better than b.

Thank g*d nobody devised a d language.

By David B. Benson (not verified) on 03 Feb 2010 #permalink

Hmmmm - C++ comments in K&R (&l)?

I'll assume that the void thingie is either #define'd or is from the newer (but worse) edition.

By Kim Dabelstein… (not verified) on 03 Feb 2010 #permalink

Not to mention case-sensitivity

[That was my point :-) -W]

By Kim Dabelstein… (not verified) on 03 Feb 2010 #permalink

#9, 10

I'm with you on the C++ style comments. But void and enum data types (not to mention case sensitivity) were in C by the early 80s, no? I guess that marks me as a hopeless newbie.

C++ style comments (which, if my memory is correct, came from either B or BCPL) have been in ISO-standard C since the 1999 standard, and were a common extension prior to that. enum was in the original K&R book and the (later) original ANSI/ISO 1989 standard, which also introduced void; both are also in the 2nd K&R book. It's possible early C was not uniformly case-sensitive, but by the time of the original K&R book, it was uniformly case-sensitive except for external identifiers on certain antiquated (even then) non-Unix systems.

#10,#11

I was referring to the original K&R which are still close to my heart, since i learned C from it in the early 80's on an AT&T system III (of all things)

void wasn't introduced before later, the reason being that a function would always return a value (int), iirc the first implementations of void did actually still return an integer (ie. pure syntactic sugar).

case-sensitivity was already there in the K&R first release, and i'm rather certain it has been there since the very beginning.

By Kim Dabelstein… (not verified) on 04 Feb 2010 #permalink

1) As usual, one can write unreadable code in any language.
However, good people can write clear code in most languages, although APL could be subject to serious abuse.

2) I learned C in 1973 from a 25-page BTL-internal memo of Ritchie's and looking at their code, since that's all there was, but reading good code was a great way to learn. that was when the total population of UNIX systems in world was ~20. The Lions' Commentary was a learning tool for legions of computer scientists.

If you rad that article, you may note that AT&T lawyers hassled John and tried to stop that from being used ... at the same time as we used John's commentaries for internal course at Bell Labs. I later lost my copies, but John, a scholar and a gentleman, kindly gave me signed replacements when I last saw him, ~year before he died, one of the reasons I own the California license plate "UNIX".

[Sounds like a clear need for an addition to your wiki page :-) -W]

3) C was certainly case-sensitive when I started with it, and I would be astonished if it had ever been otherwise.

By John Mashey (not verified) on 04 Feb 2010 #permalink

#11 bif
Are you sure about enum? I don't have the K&R first ed (oh, the shame), but all my sources say it wasn't there (including Rochkind's Advanced UNIX Programming from 1985).

enum is not in my K&R. I think it was introduced into standard C along with void well before the second edition of K&R was published.

By Alastair McDonald (not verified) on 04 Feb 2010 #permalink

Mark Hadfield | February 3, 2010 10:08 PM --- Horrors!

By David B. Benson (not verified) on 04 Feb 2010 #permalink

UNIX plate: well, it has caused amusement.
Scene: I'm sitting at a stoplight.
Car pulls up next to me, young guy rolls down his window, yells:

"Cool license plate, dude, cool plate." (this is California)
"How'd you get that plate? I'm a UNIX sysadmin, is that what you do?"
me: "Sorry, not for a long time"
(Thinking, probably not since before you were born..., i.e., the very first UNIX-based computer center didn't have full-time technical support, so some of us rotated taking TI725 terminals home and were on-call for tech support. That meant fielding occasional calls from operators (who normally did IBM mainframes, and weren't sure about this UNIX stuff), and doing things like patching filesytems by hand. Thank goodness when fsck was written.)

[this is California - good grief yes. *Talking* at the lights in England, to a stranger? The very idea is shocking -W]

By John Mashey (not verified) on 04 Feb 2010 #permalink

"*Talking* at the lights in England, to a stranger? The very idea is shocking"

Winding down the window lets the rain in. ;)