Cast to void* before casting to Node** to make the compiler do no strict-aliasing assumptions, and suppress a warning

if -fstrict-aliasing (enabled with -O2, -O3 and -Os unless forced off as is planned for the time being) is used.
See http://article.gmane.org/gmane.comp.lib.wxwidgets.devel/70262 for details.
Also return NULL instead of 0 in the same GetNodePtr, as the return type is a pointer, not integer.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37575 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mart Raudsepp 2006-02-14 09:21:37 +00:00
parent f2b8291a28
commit 9a71e770e1

View File

@ -344,10 +344,11 @@ protected: \
{ \
if( m_equals( m_getKey( (*node)->m_value ), key ) ) \
return node; \
node = (Node**)&(*node)->m_nxt; \
/* Tell the compiler to not do any strict-aliasing assumptions with the void cast */ \
node = (Node**)(void*)&(*node)->m_nxt; \
} \
\
return 0; \
return NULL; \
} \
\
/* returns NULL if not found */ \