[Python-Dev] #ifdef __cplusplus?

David Cournapeau cournape at gmail.com
Fri Jan 2 20:06:38 CET 2009


Hi Matthis,

On Sat, Jan 3, 2009 at 3:31 AM, Matthieu Brucher
<matthieu.brucher at gmail.com> wrote:

>
> When I learnt C, I was always told to explicitely cast.

Maybe your professor was  used to old C :) It is discouraged practice
to cast malloc - the only rationale I can think of nowadays is when
you have to compile the source with both a C and  C++ compiler.
Otherwise, it is redundant at best (it was useful when malloc was
defined as returning char*, and C did not allow for automatic void* to
other pointer cast).

David


More information about the Python-Dev mailing list