[Vortex] #define strlen in vortex.h

Balog Pal pasa at lib.hu
Mon Oct 4 21:06:45 CEST 2010

vortex.h has a fine landmine at line 130:

/* a definition to avoid warnings */
#define strlen (int) strlen

Hope I do not have to quote the guideline books on #define usage, forbidding 
this very approach. Or the C/C++ standards that (hopefully) declare 
#define-ing not only reserved words but library items too undefined behavior 
if followed by inclusion of any library header. What is certainly done 

Even if we set aside all the theory that renders this idea deeply WTF, or 
the innocent users who correctly use size_t in expressions along with 
strlen, expecting its mandated result-type; we get a simple and cutting one: 
broken compilation.

With VS2008, some of its headers use

(int) ::strlen( ... )

what is perfect by itself, but with this macro expands to

(int) ::(int) strlen( ... )

what is illegal.

Please eliminate this monster from the code.

More information about the Vortex mailing list