replace explicit static_cast<T>(v) with old style (T)v, just in case
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5812 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
facee0d359
commit
beb0eebd14
1 changed files with 10 additions and 3 deletions
|
|
@ -20,12 +20,17 @@
|
|||
// Activate the following macro for compilers that do not support
|
||||
// unnamed template parameters, but where memcpy works.
|
||||
//
|
||||
//#define SWIG_UNNAMED_USE_MEMCPY
|
||||
#define SWIG_UNNAMED_USE_MEMCPY
|
||||
//
|
||||
//
|
||||
#ifdef SWIG_UNNAMED_USE_MEMCPY
|
||||
// dangerous assigment, but for enums it should work.
|
||||
// "dangerous" assigment, but for enums it should work.
|
||||
// it is dangerous because you could get a bad value,
|
||||
// but it is safer than "*(T*)(void*)&x = t;", which
|
||||
// could produce a seg. fault.
|
||||
#define swig_assign_unnamed(eval, val) memcpy(&(eval),&(val), sizeof(eval))
|
||||
#else
|
||||
// much much safer choice :)
|
||||
#define swig_assign_unnamed(eval, val) printf("unnamed member assigment not supported\n")
|
||||
#endif
|
||||
#else
|
||||
|
|
@ -33,7 +38,9 @@ template <class T, class V>
|
|||
inline
|
||||
void swig_assign_unnamed(T& eval, const V& val)
|
||||
{
|
||||
eval = static_cast<T>(val);
|
||||
// it 'should' be: eval = static_cast<T>(val);
|
||||
// but just in case we found a very very old compiler
|
||||
eval = (T)val;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue