Why is python not written in C++ ?

David Cournapeau cournape at gmail.com
Fri Aug 6 09:55:49 EDT 2010


On Fri, Aug 6, 2010 at 8:39 PM, Roy Smith <roy at panix.com> wrote:
> In article <mailman.1666.1281075732.1673.python-list at python.org>,
>  David Cournapeau <cournape at gmail.com> wrote:
>
>> > Yes, there are a few corner cases where valid C syntax has different
>> > semantics in C and C++.  But, they are very few.  Calling C++ a superset
>> > of C is essentially correct.
>>
>> This is only true if you limit yourself to C89 (as python seems to
>> do). If  you start using C99 (and lot of people do, if only because
>> they don't realize it because gcc is quite relax about it), then
>> almost no non trivial C code is valid C++ in my experience.
>
> I'm not following you.  If anything, C99 makes C closer to C++.  Can you
> give me some examples of valid C99 which is not also valid C++?

variable size array, the meaning of inline, etc... In addition to int
f(void) vs int f(), legality vs illegality of p = malloc(n);, type of
enum, keyword incompatibility (new, delete, etc...) which are already
there in C89.

I have yet seen a project where you could build C code with a C++
compiler - the only ones I know are specifically designed that way and
it is painful.

David



More information about the Python-list mailing list