A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-August/037601.html below:

[Python-Dev] Forward declaration of PyObject* values

[Python-Dev] Forward declaration of PyObject* values [Python-Dev] Forward declaration of PyObject* valuesScott Gilbert xscottg at yahoo.com
Wed Aug 13 14:15:59 EDT 2003
I used the following for a similar task:

#ifndef PyObject_HEAD
struct _object;
typedef _object PyObject;
#endif

Some compilers won't like the incomplete type on the struct, but it looks
like you're using GCC which should be fine.

Since PyObject_HEAD is defined in object.h, you won't be redefining it if
the actual file is really included.  This is probably fragile, but so is
using a leading underscore in a user defined type, or having a name as
generic as _object at the global scope.  It works for now at least.


--- Tom Emerson <tree at basistech.com> wrote:
> 
> [...] I would like to forward declare PyObject so it can be used as an
> opaque type in these interfaces, and only have Python.h included in
> those source files that actually need it.
> 



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