in reply to Perl and C don't always mix well

For those of you who can't get enough of Perl...
#define elsif else if #define unless(x) if (!(x)) #define $ #define @ #define %

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Replies are listed 'Best First'.
Re: Re: Perl and C don't always mix well
by VSarkiss (Monsignor) on Nov 01, 2001 at 08:52 UTC

    Ick.

    But not as far from reality as you may imagine. For those of you who've never seen the code to the original Bourne shell, S. R. Bourne had a bunch of macros defined like this:

    #define BEGIN { #define END } #define IF if( #define THEN ){ #define ELSE }else{ #define FI } #define LOOP for(;;){ #define POOL }
    And so on. The code looked like a funky variant of Algol-68, or C written on heavy psychotropic drugs.

    I once had to debug the code when we were porting it. The only way I could cope was to run it through the C-preprocessor and awk the result. (Why not run it through Perl, you ask? It didn't exist yet....)