Message78756
I am posting this patch mainly to support python-dev discussion on this
topic. In the past (see r45330) it was possible to compile python core
and standard library modules using a C++ compiler.
According to Martin v. Löwis (issue4665), "It's not a requirement that
the Python source code is compilable as C++. Only the header files
should be thus compilable." However, I can see certain benefits from
such requirement:
1. It is hard to verify that header files are compilable if source code
is not. With compilable source code, CC=g++ ./configure; make will
supply an adequate test that does not require anything beyond a standard
distribution.
2. Arguably, C++ compliant code is more consistent and less error prone.
For example, "new" is a really bad choice for a variable name regardless
of being a C++ keyword, especially when used instead of prevailing "res"
for a result of a function producing a PyObject. Even clearly redundant
explicit casts of malloc return values arguably improve readability by
reminding the type of the object that is being allocated.
3. Compiling with C++ may reveal actual coding errors that otherwise go unnoticed. For example, use of undefined PyLong_BASE_TWODIGITS_TYPE in Objects/longobject.c.
4. Stricter type checking may promote use of specific types instead of
void* which in turn may help optimizing compilers.
5. Once achieved, C++ compilability is not that hard to maintain, but
restoring it with patches like this one is hard because it requires
review of changes to many unrelated files. |
|
Date |
User |
Action |
Args |
2009-01-02 04:56:47 | belopolsky | set | recipients:
+ belopolsky |
2009-01-02 04:56:46 | belopolsky | set | messageid: <1230872206.73.0.47638283248.issue4805@psf.upfronthosting.co.za> |
2009-01-02 04:56:46 | belopolsky | link | issue4805 messages |
2009-01-02 04:56:44 | belopolsky | create | |
|