Hi,
Do you have issues with other macros than snprintf?
In pyerrors.h, I see:
#if defined(MS_WIN32) && !defined(HAVE_SNPRINTF) # define HAVE_SNPRINTF # define snprintf _snprintf # define vsnprintf _vsnprintf #endif
A minimum fix would be to not define these functions if __cplusplus__ macro is defined.
I suggest you to open an issue at https://bugs.python.org/
Victor
Le jeu. 9 avr. 2020 à 12:24, Sylvain Corlay <sylvain.corlay@gmail.com> a écrit :
Hi All,
I hope I am not breaking any rules by posting here. I maintain a number of libraries and C++ Python extensions and one slightly annoying thing about the Python.h headers is that it includes headers defining macros such as *snprintf*.
In C++, this collides with std::snprintf defined in the <cstdio>. One backward-compatible way to make these collision less likely would be to make this macro a function-style macro - so that we could prevent the macro expansion in client code by simply adding parentheses to the calls to the actual functions.
(std::snprintf)(foobar)
In my opinion, it would make the world a better place for C++ Python extension authors :)
Best,
Sylvain
capi-sig mailing list -- capi-sig@python.org To unsubscribe send an email to capi-sig-leave@python.org
-- Night gathers, and now my watch begins. It shall not end until my death.