[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Triggers status?



On Mon, Oct 29, 2007 at 05:09:55PM -0400, Phillip Susi wrote:
> Kurt Roeckx wrote:
>> I think you're talking about an implementations of stdargs here, not what
>> the standards says should happen.  Also, padding just means padding, not
>> zero or sign extending.
>
> Yep, the standard does not mandate how it is to be implemented, but it DOES 
> mandate that a literal 0 can be used as a null pointer,

After it has been promoted to a pointer.

> which requires that 
> printf("%p", 0 ) work properly.

Which does not prompote it to a pointer.

> That effectively requires the 
> implementation to zero extend all arguments out to the same size. Either 
> way, NULL is certainly supposed to work there according to the standard, so 
> you shouldn't need (char *)0.
>
> For that matter, why would you printf NULL directly anyhow?  Usually you 
> would be printing a pointer variable, which you may have assigned to NULL, 
> making this va args discussion moot.

The code in question was doing an execlp() call.  You should end the
list of arguments with a NULL pointer.  I was just using printf() here
to show the problem since it also uses stdargs.

The manpage explicity says that it should be casted.  All the examples
SUS show that it's casted.


Kurt



Reply to: