cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Patch to get ip address last requested

From: Jamie Lokier <jamie_at_shareable.org>
Date: Wed, 20 Jul 2005 19:48:18 +0100

Jamie Lokier wrote:
> Gisle Vanem wrote:
> > >+ if ( !cachedIp ) return CURLE_FAILED_INIT;
> > >+
> > >+ struct Curl_multi *multi=(struct Curl_multi *)multi_handle;
> > >+ struct SessionHandle *easy=(struct SessionHandle *)easy_handle;
> >
> > It may be a good feature you've contribuited. But don't use
> > C++ features like this. Only gcc supports this AFAIK. Define
> > variables at top of scope.
>
> Actually this feature has been standard in C since 2000 (the "C99"
> ANSI/ISO standard), and is supported by all modern C compilers.
>
> But you're right to object because of course it's not portable to
> older C compilers.

Btw, to avoid accidentally introducing this type of code, you can use
-Wdeclaration-after-statement with current GCC, to get a warning.

-- Jamie
Received on 2005-07-20