Unix Programming - Re: variadic null ptr

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > May 2007 > Re: variadic null ptr





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: variadic null ptr
Bjorn Reese

2007-05-26, 7:21 am

Bjorn Reese wrote:

> That is a good question. According to my reading of C99, char and float
> are not compatible [6.2.7] even after default argument promotion, so
> char * and float * are not compatible either [6.7.5.1/2, 6.2.5/27].
> Getting an incompatible pointer with va_arg() invokes undefined behavior
> [6.5.2.2/6].
>
> Another way to look at it is that void * and char * are required to have
> the same representation and alignment, but char * and float * are not
> [6.2.5/17].


I should add that by the time I wrote the above, I was not aware that
SUS has an added requirement for va_arg() to handle all pointer types
as compatible. So, if execl() is implemented with va_arg() then there is
no difference between using "(char *)0" or "(float *)0" as the last
argument.

--
mail1dotstofanetdotdk
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com