From: Martin v. Loewis on
Am 10.08.2010 09:06, schrieb Ulrich Eckhardt:
> Carl Banks wrote:
>> I highly doubt the Python source would build with a C++ compiler.
>
> As Christian showed, it doesn't. However, look around the sources a bit.
> There are lots of places where e.g. the returnvalue of malloc() (or,
> rather, the macro that resolves to something like it) is explicitly
> type-cast to the according pointer type. When asked on the developers'
> list, it was said that this was intended for compatibility with C++, e.g.
> in cases where people want to embed Python into their C++ projects. Of
> course, this contradicts Christian's statement that C++ compatibility
> wasn't considered useful enough.

It doesn't contradict at all. In order to embed Python into a C++
application, it is sufficient if the Python header files can be compiled
with a C++ compiler, and linking to the C function works
properly - which is indeed the case.

People integrate Python with C++ quite often, both for embedding it
into C++, and for writing extension modules in C++.

Regards,
Martin
From: Ulrich Eckhardt on
Martin v. Loewis wrote:
> Am 10.08.2010 09:06, schrieb Ulrich Eckhardt:
>> When asked on the developers' list, it was said that this was
>> intended for compatibility with C++, e.g. in cases where people
>> want to embed Python into their C++ projects. Of course, this
>> contradicts Christian's statement that C++ compatibility
>> wasn't considered useful enough.
>
> It doesn't contradict at all. In order to embed Python into a C++
> application, it is sufficient if the Python header files can be compiled
> with a C++ compiler, and linking to the C function works
> properly - which is indeed the case.

That's true, maybe I don't remember the exact rationale. Especially if even
someone like you, who is much deeper into Python development, doesn't, I'm
wondering if I'm misremembering something....

Cheers!

Uli

--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

From: sturlamolden on
On 11 Aug, 08:40, Ulrich Eckhardt <eckha...(a)satorlaser.com> wrote:

> That's true, maybe I don't remember the exact rationale. Especially if even
> someone like you, who is much deeper into Python development, doesn't, I'm
> wondering if I'm misremembering something....

Header (definition) and source (implementation) is not the same. A C++
compiler can use Python's header files and link with Python's C API
correctly. But it cannot compile Python's C source code. A C compiler
is required to compile and build Python.

From: Ulrich Eckhardt on
sturlamolden wrote:
> On 11 Aug, 08:40, Ulrich Eckhardt <eckha...(a)satorlaser.com> wrote:
> Header (definition) and source (implementation) is not the same.

I'm aware of this and that's not the thing I was talking about.

Uli

--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932