-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make python code compilable with a C++ compiler #49055
Comments
I am posting this patch mainly to support python-dev discussion on this According to Martin v. Löwis (bpo-4665), "It's not a requirement that
|
A related question discussed on python-dev is whether extern "C" {} The new patch eliminates several uses of extern "C" {} in .c files while |
Moving declarations into header files is not really in line with the way We usually only put code into header files that is meant for public use. Buy putting declarations into the header files without additional |
Also note that by removing the extern "C" declarations, you not only Those would also have to get declared in the header files, to prevent |
The added type casts are useful to have - even outside the context of |
On Fri, Jan 2, 2009 at 10:54 AM, Marc-Andre Lemburg
What are " exported globals" other than "exported symbol names of
I believe .c files should only contain static functions and functions |
On 2009-01-03 04:38, Alexander Belopolsky wrote:
GCC doesn't appear to do so, but there's no guarantee that other http://en.wikipedia.org/wiki/Name_mangling
That's right, but I was referring to non-function globals. OTOH, those globals will often not be accessed directly from other |
On 2009-01-05 13:03, Marc-Andre Lemburg wrote:
> Marc-Andre Lemburg <[email protected]> added the comment:
>
> On 2009-01-03 04:38, Alexander Belopolsky wrote:
>> Alexander Belopolsky <[email protected]> added the comment:
>>
>> On Fri, Jan 2, 2009 at 10:54 AM, Marc-Andre Lemburg
>> <[email protected]> wrote:
>>> Marc-Andre Lemburg <mal@egenix.com> added the comment:
>>>
>>> Also note that by removing the extern "C" declarations, you not only
>>> changes the exported symbol names of functions, but also those of
>>> exported globals.
>>>
>> What are " exported globals" other than "exported symbol names of
>> functions"? AFAIK, C++ does not mangle non-function symbols.
>
> GCC doesn't appear to do so, but there's no guarantee that other
> C++ compilers won't touch these symbols:
>
> http://en.wikipedia.org/wiki/Name_mangling Issue bpo-4846 is a good example of a situation where such name mangling |
On Mon, Jan 5, 2009 at 11:43 AM, Marc-Andre Lemburg
You are right, I did not know that fact about MS compilers. I am not The allocs counters (tuple_zero_allocs, fast_tuple_allocs, I find it hard to get motivated to do a more thorough review of the I see little to be gained in refining the patch further to support |
On 2009-01-05 19:55, Alexander Belopolsky wrote:
For completeness, all exported symbols in Python should have a _Py_
Like I mentioned earlier on: those declarations did serve a purpose Given that you can build Python as library on Unix and as DLL on |
On Mon, Jan 5, 2009 at 2:58 PM, Marc-Andre Lemburg
I actually agree, but I felt that doing this as a part of this patch The only downside of having them is that a #ifdef __cplusplus
So what is your position on the proposed patch? Is it worthwhile to I think using C++ as a lint variant from time to time is a good |
On 2009-01-05 22:06, Alexander Belopolsky wrote:
I agree with using C++ compatibility as additional means of checking Making sure that all exported private symbols get a _Py prefix and I'm not sure about removing the extern "C" declarations altogether. |
Duplicate of #91321 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: