Now on ScienceBlogs: HeartlandGate: Anti-Science Institute's Insider Reveals Secrets

ScienceBlogs Book Club: Inside the Outbreaks

Stoat

Taking science by the throat... climate, rowing, and misc.

Profile

Me My family and me. More...

Make sure you're familiar with the Comment Policy

Confused by my constant use of abbreviations? Then you need the Glossary

Search

Recent Posts

Recent Comments

Archives

Blogroll

Other Information

Co-moderator of globalchange mailing list Subscribe to globalchange
Email:
Browse at groups.google.com
I've been using Google Reader recently, following the lamented death of Planet Fleck, and I suppose I have to admit its better. Here are some "shared items" if, for some reason, you want to read what I read.

« Comment 10k: the winner! | Main | Who is William A. Sprigg, Ph.D.? »

Not the post you were looking for

Category: tech
Posted on: February 3, 2010 5:11 PM, by William M. Connolley

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.

Share on Facebook
Share on StumbleUpon
Share on Facebook

TrackBacks

TrackBack URL for this entry: http://scienceblogs.com/mt/pings/130979

Comments

1

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]

Posted by: dhogaza | February 3, 2010 5:26 PM

2

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]

Posted by: carrot eater | February 3, 2010 5:48 PM

3

Now my life is complete.

Posted by: Greg Laden | February 3, 2010 5:55 PM

5

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.

Posted by: Gray Gaffer | February 3, 2010 8:04 PM

6

Well, c is better than b.

Thank g*d nobody devised a d language.

Posted by: David B. Benson | February 3, 2010 8:26 PM

8

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.

Posted by: Kim Dabelstein Petersen | February 4, 2010 12:19 AM

9

Not to mention case-sensitivity

[That was my point :-) -W]

Posted by: Kim Dabelstein Petersen | February 4, 2010 12:22 AM

10

#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.

Posted by: Deep Climate | February 4, 2010 12:50 AM

11

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.

Posted by: blf | February 4, 2010 2:04 AM

12

#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.

Posted by: Kim Dabelstein Petersen | February 4, 2010 11:36 AM

13

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.


Posted by: John Mashey | February 4, 2010 2:02 PM

14

#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).

Posted by: Deep Climate | February 4, 2010 4:13 PM

15

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.

Posted by: Alastair McDonald | February 4, 2010 5:37 PM

16

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

Posted by: David B. Benson | February 4, 2010 8:56 PM

17

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]

Posted by: John Mashey | February 4, 2010 11:48 PM

18

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

Winding down the window lets the rain in. ;)

Posted by: Adam | February 5, 2010 7:52 AM

Post a Comment

(Email is required for authentication purposes only. On some blogs, comments are moderated for spam, so your comment may not appear immediately.)





ScienceBlogs

Search ScienceBlogs:

Go to:

Advertisement
Follow ScienceBlogs on Twitter

© 2006-2011 ScienceBlogs LLC. ScienceBlogs is a registered trademark of ScienceBlogs LLC. All rights reserved.