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/2002-April/022311.html below:

Suggested memory API rules for 2.3

[Python-Dev] Re: Suggested memory API rules for 2.3Tim Peters tim.one@comcast.net
Thu, 04 Apr 2002 11:38:54 -0500
[Neil Schemenauer]
> People will have to cast to PyObject* when calling PyObject_GC_Del.

This depends on whether you want to leave its signature alone, or declare it
as taking a void*.

> I guess that will be consistent with the other _Free and _Del functions.

One reason I prefer the other _Free functions over their _Del versions is
that they're already declared to take void*, just like C free(); e.g.,

    extern DL_IMPORT(void) PyObject_Free(void *);

Some of our macros do redundant casts to void* now when invoking these guys.

In any case, if people stick to the "recommended" API {PyMem,
PyObject)_Free, they should not need to cast their arguments.

Note that there's no type safety in the way we've actually implemented
things even for the PyObject_Del spelling:

#define PyObject_Del(op) _PyObject_Del((PyObject *)(op))

That is, no matter what kind of goofy pointer a programmer may pass, we
silently cast it to PyObject* anyway.  Better then (IMO) to change
_PyObject_Del's signature to void*, let *it* cast to PyObject* internally,
and lose the macro trick.





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