cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_easy_setopt and typeof

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Sun, 13 Apr 2008 17:45:54 -0700

On Sun, Apr 13, 2008 at 01:42:08PM -0400, Nathan E. Moore wrote:
> Section 7.15.1.1 The va_arg macro (also available at
> <http://www.opengroup.org/onlinepubs/009695399/basedefs/stdarg.h.html>)
> ...
> The parameter type shall be a type name specified such that the type of a
> pointer to an
> object that has the specified type can be obtained simply by postfixing a *
> to type. If
> there is no actual next argument, or if type is not compatible with the type
> of the
> actual next argument (as promoted according to the default argument
> promotions), the
> behavior is undefined, except for the following cases:
  ^^^^^^^^^^^^^^^^^^^^^
> €” one type is a signed integer type, the other type is the corresponding
> unsigned integer
> type, and the value is representable in both types;
> €” one type is pointer to void and the other is a pointer to a character
> type.
>
> I guess the way I read it says that you do get argument promotion. I would
> assume the
> promotion would be done prior to pushing the arguments onto the stack. But I
> have been
> wrong before and likely will be again.

There is now way the compiler would know the expected type at the time of
calling in order to do the promotion. The behaviour in this case is, as
documented, undefined.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2008-04-14