On 11/06/2013 15:14, Robin Watts wrote:
There is a VERY good reason for the while being there. I will try to
explain:
Imagine that you have the following code:
if (x == 0)
FT_ASSERT(some_condition);
else
return 42;
return 23;
Without the while loop, the code would expand to:
if (x == 0)
if (!some_condition)
FT_Panic( ... );
else
return 42;
return 23;
(indentation changed for clarity)
i.e. the behaviour of the code is changed for x == 0;
Thanks for the explanation Robin,
That being the case, this solution works for MSVC:-
#define FT_ASSERT( condition ) \
{ \
if ( !( condition ) )
\
FT_Panic( "assertion failed on line %d of file
%s\n", \
__LINE__, __FILE__ );
\
}
In fact, a similar strategy is already being used in the definition of
'FT_THROW' so I guess it should work for other compilers too.
John
_______________________________________________
Freetype-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/freetype-devel