freetype-devel
[Top][All Lists]
Advanced

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

Re: Bugs, bugs, bugs.


From: Joerg Pommnitz
Subject: Re: Bugs, bugs, bugs.
Date: Mon, 31 Jul 2000 19:20:06 +0200

Just another remark:

While common practice the current code is hackish.
It relies on the fact that the NULL pointer is actually 
represented as a zero value (which means all bits zero).
This is true on most modern machines, but is not guaranteed
by any standard.
My suggestion:
1) use offsetof if it is available
2) make an autoconf test for the validity of the current solution
3) fail for everything else

Regards
    Joerg

----- Original Message ----- 
From: Werner LEMBERG <address@hidden>
To: <address@hidden>
Cc: <address@hidden>
Sent: Monday, July 31, 2000 6:56 PM
Subject: Re: Bugs, bugs, bugs.


> 
> >         FT_FRAME_USHORT( num_tables ),
> > 
> > The error message is:
> > 
> > Error   : illegal constant expression
> > 
> > I traced it down to this macro:
> > 
> > #define FT_FIELD_OFFSET( f ) \
> >           (FT_UShort)( (char*)&(((FT_STRUCTURE*)0)->f) - (char*)0 )
> > 
> > It's complaining about the (char*)0 bit.
> > 
> > I have no idea how to fix this correctly (it looks pretty hack-ish
> > to me ;-).
> 
> Basically, it isn't `hackish'.  Previously, the macro directly
> converted a (char *) to FT_UShort -- some compilers dislike this.
> Now, we have a substraction of two (char *) pointers which always
> yields an integer.
> 
> How does your compiler defines NULL?  Please try (void*) instead of
> (char*) for both pointers.
> 
> 
>     Werner




reply via email to

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