cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_easy_setopt and typeof

From: Jamie Lokier <jamie_at_shareable.org>
Date: Mon, 14 Apr 2008 10:18:51 +0100

Nathan E. Moore wrote:
> --On Sunday, April 13, 2008 5:45 PM -0700 Dan Fandrich
> <dan_at_coneharvesters.com> wrote:
>
> >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.

Specifically, the "default argument promotions".

> I meant that floats are all
> promoted to
> doubles,

That's right.

> smaller integral types to long/unsigned long,

No. They are promoted to int/unsigned int.

If the varargs function needs a long, it won't get one. On common
architectures nowadays, int and long are different sizes.

-- Jamie
Received on 2008-04-14