[PyKDE] Two minor sip issues
Gerard Vermeulen
gerard.vermeulen at grenoble.cnrs.fr
Sun Jun 19 15:21:33 BST 2005
Phil
(1 ) sip.h contains the lines
#if !defined(ANY)
#define ANY void
#endif
and as far as I can see, ANY isn't used anywhere by SIP or its generated code.
However, it pollutes the global namespace with nasty side effects, eg
enum { ANY = 0 };
is preprocessed to
enum { void = 0 };
(2) Since I like to have my extensions compatible with different versions of SIP
and since changes are introduced with snapshots, I like to see a
#define SIP_BUILD_NUMBER in sip.h.
This makes it easier to write code like:
virtual ~SoGroup();
%MethodCode
#if SIP_BUILD_NUMBER < 320
SoGroup *sipCpp = reinterpret_cast<SoGroup*>(sipSelf->u.cppPtr);
#endif // SIP_BUILD_NUMBER < 320
...
%End
where SIP_BUILD_NUMBER has been figured out from calling 'sip -V'.
(SIP_BUILD being a string, I failed to use it in comparisons, if possible at all).
An alternative is to put sip_build and/or sip_build_str in sipconfig.py
Gerard
More information about the PyQt
mailing list