develooper Front page | perl.perl5.porters | Postings from July 2005

Re: your malloc patches

Thread Previous | Thread Next
Joshua Hoblitt
July 18, 2005 14:59
Re: your malloc patches
Message ID:
On Sun, Jun 15, 2003 at 09:14:16PM +0300, Jarkko Hietaniemi wrote:
> > > This just isn't cricket for non-GCC compilers (Solaris, AIX, and Tru64
> > > claim a syntax error, IRIX seems to tolerate it).  That a function
> > > call (Perl_doing_taint in this case) gets expanded to func(a,b,) just
> > > isn't going to work.  (What does leaving out an argument like that
> > > _mean_, anyway?  An implicit 0?)
> > 
> > It is a *macro*, not a function call!  Macros operate on strings.  An
> > empty string is a perfectly valid string (though I do not know what
> When the macro gets expanded at the very beginning of main() we get this:
> 	if (Perl_doing_taint(*&argc, *&argv, ))
> which makes many C compilers to choke, but apparently not gcc.
> > the C standard says on this).
> > 
> > Anyway, this slot is not used, so put there NOTUSED.
> I have no idea what you mean by NOTUSED.  If you mean the trick you said:
> #define NOTUSED
> #define MALLOC_CHECK_TAINT2(argc,argv)  MALLOC_CHECK_TAINT(argc,argv,NOTUSED)
> That doesn't work since that gets expanded to exactly the same as above.

A possible solution would be to use __VA_ARGS__.  I'm not sure how
portable this is between cpp implementations... it supposedly has worked
with gcc since at least 2.95 (I haven't tried it with anything older
than gcc 3.3) and it is part of C99.




Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About