freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] Build Warnings, Should I Be Concerned


From: David Turner
Subject: Re: [Devel] Build Warnings, Should I Be Concerned
Date: Fri, 25 Oct 2002 15:14:38 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2a) Gecko/20020910

Hello,

Julian gardner wrote:
Below is a dump of the warnings given by the Metaware ARC Compiler for nearly every source file compiled w "src/winfonts/winfnt.c",L172/C25(#572): face: Potentially dangerous pointer cast: | sizeof `struct FT_FaceRec_' ("include/freetype/freetype.h",L662/C19) differs from | sizeof `struct FNT_FaceRec_' ("include/freetype/internal/fnttypes.h",L137/C19) and
|    accessing an lvalue through this pointer alias may violate assumptions
|    in the ANSI C Language Reference used by the optimizer.
|    (See (X3.159-1989 p.39,L18) on object access for more details.)

Well, your compiler and/or the ANSI C specification are probably
a bit too anal-retentive :o)

Fact is that FNT_FaceRec is a "sub-class" of FT_FaceRec, i.e.
it's definition is:

  typdef struct FNT_FaceRec_
  {
    FT_FaceRec   face;    /* first field !! */

    ....
  } FNT_FaceRec;

so casting a FNT_Face to a FT_Face is always a valid operation. It's
also the only way to implement simple object-oriented programming in
C by the way :-)

I haven't the ANSI specification here, but I'd be surprised is those
specific cases were not considered as valid by it. In all cases, you
should not be alarmed by the warnings.

You're the first person to report this "problem" by the way. As a
quick note, both GCC and Visual C++ report 0 warnings when compiling
FreeType at their highest warning levels (respectively
"-W -Wall -ansi -pedantic" and "/W4").

Well, some versions of GCC do report a warning, but that's apparently
a compiler bug that occurs when trying to optimize code that uses
"volatile" local variables :-)

Hope this helps

- David Turner
- The FreeType Project  (www.freetype.org)




reply via email to

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