[Cython] RFC: an inline_ function that dumps c/c++ code to the code emitter

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Aug 22 02:59:02 EDT 2016

Robert Bradshaw wrote:
> Name mangling is done for the standard reasons--to avoid possible
> conflicts with all other symbols that may be defined.

The main reason for mangling names is that top-level declarations
in Cython belong to a module namespace, whereas C just has a
single namespace for all globals. So some way is needed to
distinguish things with the same name in different modules.

Also, a single Cython declaration often leads to several
different related things being declared in C, e.g. a class
has a PyType instance, a struct declaration, and possibly
a vtable, all of which need distinct names in the C code,
so prefixes are used to distinguish them.

It might be possible to get away without mangling a few
things, such as local variables, but for simplicity they're
treated the same as everything else.


More information about the cython-devel mailing list