cURL / Mailing Lists / curl-library / Single Mail


Re: Compiler error with c-ares and Visual studio 2012

From: Myria <>
Date: Thu, 14 Nov 2013 22:40:45 -0800

stdint.h is included with Visual Studio 2010 and later (_MSC_VER >= 1600),
but I guess that the cURL headers don't recognize this...? It has
everything you'd expect: uint32_t, uint_least64_t, UINT64_C().

-----Original Message-----
From: Steve Holme
Sent: Sunday, November 10, 2013 9:58 AM
To: 'libcurl development'
Subject: RE: Compiler error with c-ares and Visual studio 2012

On Sun, 10 Nov 2013, Kim Vandry wrote:

> I would prefer not to use "u_long" for this variable because
> that type, which I guess is the same as "unsigned long", is not
> guaranteed by C to be any particular width: it could be more
> than 32 bits. But in this case we have an IPv4 address, which is
> known to need exactly 32 bits, no more, no less.

Agreed - but I guess Andreas choose this as the Windows header files tend to
use it for s_addr ;-)

> I am surprised that uint32_t would not be usable here because
> it's used apparently successfully by c-ares itself (it's in the
> declaration of "ares_set_local_ip4").

I'm a little surprised myself that Visual Studio 2012 had problems as I
thought the newer intXX_t, uintXX_t types were part of C++ 11 and as such
stdint.h should be included with Visual Studio 2011/2012.

> I surveyed some other locations in the Curl source code, and
> it appears that including <stdint.h> and using uint32_t is not
> common. Instead, the convention throughout seems to be to
> use "struct in_addr" to hold IPv4 addresses. So let's do that.

Thanks - pushed as commit 0f81fbe5da6643.

(Although I forgot to include the bug report and credit to Andreas in the
commit notes! - I'll update the RELEASNOTES with that info).

Kind Regards

List admin:

List admin:
Received on 2013-11-15