freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] WIP PATCH: clang static analyzer and warning fixes


From: Werner LEMBERG
Subject: Re: [ft-devel] WIP PATCH: clang static analyzer and warning fixes
Date: Wed, 18 Jun 2014 07:05:19 +0200 (CEST)

>> I submit that there is a code smell here.  The code is funky enough
>> to trick two different tools, humans, and human reviewers.  While
>> it may be 'correct', it's probably too complicated and should be
>> refactored in some way.
>
> It is a hack of code! I'll try to understand it fully and rework.
> You are welcome to do that too.

It's not *that* mysterious!  The code looks like this.

  bool flag = 0;

  while {
    int a;

    ...
    if (flag)
      a = 1;
    else
      a = 0;
    ...
    flag = 1;
  }

Normally, compilers can recognize that initializations happen within
an if-else clause.  But apparently clang and MSVC try to be clever...

FreeType's `make devel' activates *a lot* of gcc warnings, but I don't
get something similar.

I've now changed this to

  int a = 0;
  bool flag = 0;

  while {
    ...
    if (flag)
      a = 1;
    else
      a = 0;
    ...
    flag = 1;
  }


    Werner



reply via email to

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