cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: compiling with C++ compiler

From: Alan Wolfe <alan.wolfe_at_gmail.com>
Date: Thu, 3 Feb 2011 14:49:33 -0800

What compiler are you using?

Using microsoft visual studio i dont get the errors you are, it compiles
just fine as C++ for me.

On Thu, Feb 3, 2011 at 2:28 PM, Prashant R <ramapra_at_gmail.com> wrote:

> I know that this library was intended to compile in C however I have
> certain limitations where this needs to be compiled using a C++ compiler .
>
> I need to make some changes for these .
>
> A lot of the changes are fixing cast incompatiblities
>
> one such example is
>
> new_rb = realloc(in->buffer, new_size);
>
>
> where the LValue is of type X and the R Value is void * .
>
>
> This compiles fine in a C compiler but is a compile error in C++ .
>
>
> I am wondering if there is any harm in doing the explicit cast in code so
> that C++ compilers will readily compile.
>
> I understand that this might be a huge change for the library and if this
> has been the way for historical reasons !
>
>
> Other changes that I needed were
>
>
> - Providing the outer structure (using scope resolution) for an enum within
> a structure
>
>
> example
>
> http->sending == HTTPSEND_REQUEST
>
>
> to
>
> http->sending == HTTP::HTTPSEND_REQUEST ( or including namespace HTTP at
> the top of the .c file) .
>
>
>
>
> - Increment of enum types within a struct
>
> Example
>
> http->sending++ seemed to be an issue .
>
>
> Had to provide some special treatment to be able to get around this .
>
>
> I guess I am being picky and in no way am trying to disregard the value of
> this library .
>
>
> I am looking for solutions for issues that I've faced and am sure other
> users might have had such issues. Just wanted to know what steps they took
> to be able to resolve this .
>
>
> Thanks
>
>
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-02-03