Front page | perl.perl5.porters |
Postings from July 2005
Re: your malloc patches
Thread Previous
|
Thread Next
From:
Jarkko Hietaniemi
Date:
July 19, 2005 00:14
Subject:
Re: your malloc patches
Message ID:
42DCA835.30000@gmail.com
Joshua Hoblitt wrote:
> 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.
Perl sources are C89 compliant and generally try to stay so (i.e. not
introduce C99-isms, at least not unconditionally so). But thanks for
the information, that may turn out to be useful for something else.
> #define MALLOC_CHECK_TAINT2(argc,...) MALLOC_CHECK_TAINT(argc,__VA_ARGS__)
It was two years ago :-) but I think, based on the current perl.h,
that we just opted for assuming that the third argument to main while
non-standard is at least tolerated widely enough:
#define MALLOC_CHECK_TAINT2(argc,argv) MALLOC_CHECK_TAINT(argc,argv,NULL)
>
> --
Thread Previous
|
Thread Next