A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2009-January/084693.html below:

[Python-Dev] #ifdef __cplusplus?

[Python-Dev] #ifdef __cplusplus? [Python-Dev] #ifdef __cplusplus?Alexander Belopolsky alexander.belopolsky at gmail.com
Fri Jan 2 07:24:25 CET 2009
On Fri, Jan 2, 2009 at 12:58 AM, Adam Olsen <rhamph at gmail.com> wrote:
..
>
> As C++ has more specific ways of allocating memory, they impose this
> restriction to annoy you into using them.

And so does Python API: see PyMem_NEW and PyMem_RESIZE macros.

>  We won't be using them, and the extra casts and nothing but noise.

A quick grep through the sources shows that these casts are not just nose:

Objects/stringobject.c:	op = (PyStringObject *)PyObject_MALLOC(..
Objects/typeobject.c:	remain = (int *)PyMem_MALLOC(..
Objects/unicodeobject.c:	unicode->str = (Py_UNICODE*) PyObject_MALLOC(..

in many cases the type of object being allocated is not obvious from
the l.h.s. name.  Redundant cast improves readability in these cases.

>  Figure out a way to turn off the warnings instead.
>
These are not warnings: these are compile errors in C++.  A compiler
which allows to suppress them would not be a standard compliant C++
compiler.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4