in reply to hangover from perl...

I not only write code in Perl but in C, C++ and JavaScript and can so fully relate. Not as bad is when I write stuff in assembler. At least when I'm coding in assembler I go into "assembler mode" and don't mix so badly.

Actually, back in the day when I was coding in both Z80 and MC6800x0 assembler I used to mix syntaxes. This normally occured during one of those all-night sessions we all know and love. When sleep deprivation takes over and caffiene just doesn't cut it any more.

Many is the time when I am writing C code I have wanted to do string operations like:

buffer1 .= buffer2;
or
buffer =~ s/\s+$//;
or some other Perlism. Or this in Perl code:
for(ix=0;ix<=5;ix++) { : :
Where are the dollar signs?

Can you spot the C code syntax errors here:

for(ix=0;ix<=$#buffer;ix++){ $buffer[$ix]='\0'; }
Just did that one last week at about 1AM.

Replies are listed 'Best First'.
Re: Re: hangover from perl...
by exussum0 (Vicar) on Apr 27, 2004 at 15:25 UTC
    You could overload the $ and .= symbols.. :)
      Well, I don't know if you can override something that isn't an operator, but you can make macros and such :)

      Reminds me of the funny joke I saw once about C written in PASCAL:

      #define BEGIN { #define END }

      of course that can be made much more complex once our macros start taking parameters! :)