[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [patch][c++] fix "invalid conversion from ‘void*’ to ‘char*’"
- From: Sean Conner <sean@...>
- Date: Sun, 26 Jun 2016 17:11:42 -0400
It was thus said that the Great Irfan Adilovic once stated:
> In the 5.3.3 release, lua/lstrlib.cc:936:
>
> char *ppoint = memchr(buff, point, nb);
>
> is not valid c++ code. This should be fixed with a c-style cast:
But it *is* valid C code. In C, it's recommended *not* to cast the result
of malloc() as it can hide errors (mainly missing declarations---in C,
without a prototype, the compiler will assume a function returns an int).
> @@ -935,3 +935,3 @@ static void checkdp (char *buff, int nb) {
> char point = lua_getlocaledecpoint(); /* try locale point */
> - char *ppoint = memchr(buff, point, nb);
> + char *ppoint = (char *)(memchr(buff, point, nb));
> if (ppoint) *ppoint = '.'; /* change it to a dot */
I would recommend against this patch.
-spc (But then again, I program in C, not C++)