[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [patch][c++] fix "invalid conversion from ‘void*’ to ‘char*’"
- From: Lorenzo Donati <lorenzodonatibz@...>
- Date: Tue, 28 Jun 2016 20:14:25 +0200
On 28/06/2016 19:00, Roberto Ierusalimschy wrote:
Wouldn't it be useful to use some macro magic to remove the cast
when the code is built as plain C, so that the code the compiler
sees is conforming both as C and as C++?
Currently, the code the compiler sees is already conforming both to C
and C++. Why that macro would be useful?
Sorry, I used the wrong words. I didn't really mean "conforming" as
"conforming C implementation".
What I really meant was that with that macro you could perform the cast
on the pointer returned from malloc only when compiling as C++, and
avoid the cast in C, in order to "conform" to C best practices  that
advice against casting that pointer (as opposed as what you should do in
C++), as Sean said.