If HP Lovecraft wrote C manuals

I can't say that it made me a better programmer, but this mashup of Brian W Kernighan & Dennis M Ritchie's classic "The C Programming Language" with the elder horrors of HP Lovecraft's Cthulhu mythos has alerted me to the urgent problem of inadvertent dimensional rifts that may be opened through poor programming practice:

And yet I saw them in a limitless stream- flopping, hopping, croaking, bleating- sorting themselves inhumanly through the spectral moonlight in a grotesque, malignant saraband of fantastic nightmare. Their croaking, baying voices called out in the hideous language of the Old Ones:

void Rlyeh
(int mene[], int wgah, int nagl) {
int Ia, fhtagn;
if (wgah>=nagl) return;
swap (mene,wgah,(wgah+nagl)/2);
fhtagn = wgah;
for (Ia=wgah+1; Ia<=nagl; Ia++)
if (mene[Ia] swap (mene,++fhtagn,Ia);
swap (mene,wgah,fhtagn);
Rlyeh (mene,wgah,fhtagn-1);
Rlyeh (mene,fhtagn+1,nagl);


The C Programming Language (via JWZ)


  1. It’s not exactly a “mashup”, it’s a rewrite/pastiche of “The Shadow Over Innsmouth”.

    Good for a laugh, tho. Thanks !

  2. It is too a mashup– I just bludgeoned section 4.10 of K&R (2nd ed.) into The Shadow over Innsmouth by brute force (this was for the previous BoingBoing mashup contest). You’re right about the C++ comments, though. Now I feel like a total asshole.

    1. Your compiler fails to produce an executable, as a means of protecting its sanity. It is not a syntax “error”, your compiler simply lacks the fortitude to face the horrifying implications of the syntax.

  3. Too bad it’s spelt ‘fthagn’.

    In both programming and summoning eldritch horrors, spelling and pronunciation matter!

  4. The code in the quotation above is broken because… something… has eaten the characters after the less-than sign, but the original compiles OK.

    Of course, the linker will give errors because swap() and main() have been left as exercises for the reader and even if they hadn’t, the creeping squamous symbols in this code may well cause ld to go utterly insane and link your face to thousands of tiny screaming spiders.

Comments are closed.