freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] MSVC build woes !


From: John Emmas
Subject: Re: [ft-devel] MSVC build woes !
Date: Tue, 11 Jun 2013 15:56:49 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]