void -> char cast

Emmanuel Thomé emmanuel.thome at gmail.com
Thu Jan 9 12:47:02 UTC 2014


I don't see any good reason for compiling C code with a C++ compiler.

While I do agree that being nice to C++ compilers is important in
header files, my opinion is that accomodating the needs of C++
compilers in the C source files would yield unnecessary noise.

E.

On Thu, Jan 9, 2014 at 1:44 PM, Vincent Lefevre <vincent at vinc17.net> wrote:
> On 2014-01-09 10:44:46 +0100, Torbjorn Granlund wrote:
>> Conor Williams <conor.williams at gmail.com> writes:
>>
>>   Ubuntu - found when compiling with g++
>>
>>   will51 at skynet:~/LPS!/lpsb/gmp-5.1.3/demos/expr$ diff exprfa.c exprfa.c.orig
>>   122c122
>>   <   edup = (char *)(*allocate_func) (i+1);
>>   ---
>>   >   edup = (*allocate_func) (i+1);
>>
>>
>>   will51 at skynet:~/LPS!/lpsb/gmp-5.1.3/demos/expr$ diff exprza.c.orig exprza.c
>>   51c51
>>   <   edup = (*allocate_func) (i+1);
>>   ---
>>   >   edup = (char *)(*allocate_func) (i+1);
>>
>> You sent the above to the GMP bug reports mailing list.  Are we to
>> interpret it as a bug report?  I just see two patches (one apparently
>> backwards) with no explaation for what they are supposed to fix.
>
> Conor's bug report is not very good, but I think that this is quite
> clear: the cast to (char *), needed by C++ compilers, is missing
> here, while always present in the source of the library itself.
> It seems that the same thing as in mpz/get_str.c[*] (for instance)
> should be done.
>
> [*] mpz/get_str.c, line 70:
>       res_str = (char *) (*__gmp_allocate_func) (alloc_size);
>
> --
> Vincent Lefèvre <vincent at vinc17.net> - Web: <http://www.vinc17.net/>
> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
> _______________________________________________
> gmp-bugs mailing list
> gmp-bugs at gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-bugs


More information about the gmp-bugs mailing list