Of course not. (: The C preprocessor is mostly just text substitution and is defined to not care about the order in which things are defined.
A more interesting case that also doesn't work is:
#include <stdio.h>
void flee(int i) { printf("flee(%d)\n",i); }
void perlFlee(int i) { printf("perlFlee(%d)\n",i); }
int main()
{
flee(1);
#define flee perlFlee
flee(2);
#define _stitch(a,b) a ## b
#define Free(x) _stitch(fl,ee)( x )
Free(3);
return 0;
}
Which produces "perlFlee(3)" as its last line of output.
And this tenancity of the C preprocessor is why (at least when the idea of XS came about), there should have been (similar to several other changes that were made for similar reasons) a global s/\bfree\b/Perl_free/, and s/\bmalloc\b/Perl_malloc/g done to the Perl source code so "#define free..." could be eliminated (replaced with "#define Perl_free free" for some systems, of course).
|