freetype-devel
[Top][All Lists]
Advanced

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

RE: [ft-devel] freetype compilation warnings


From: David Bevan
Subject: RE: [ft-devel] freetype compilation warnings
Date: Tue, 12 Jan 2010 04:43:39 -0500

All the proposed solutions assume that there is a (known) integer size which 
matches the pointer size. This is clearly a compiler-specific requirement.

For example, in the latest proposal below, if unsigned long is 32-bit and void* 
is 64-bit [which I believe is the case with 64-bit MSVC - which is LLP64], 
ALL_POINTS receives the value 0xFFFFFFFF (~0UL) rather than the expected 
0xFFFFFFFFFFFFFFFF - hence the helpful compiler warning.

I would expect something like the following to work (though I don't have a 
suitable compiler to hand to test).

#define ALL_POINTS  (FT_UShort*)((FT_Byte*)(NULL) - 1);

Hth,

David %^>



-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Ken Sharp
Sent: 12 January 2010 08:12
To: Sean McBride
Cc: address@hidden
Subject: Re: [ft-devel] freetype compilation warnings

At 12:28 11/01/2010 -0500, Sean McBride wrote:


> >#define ALL_POINTS  (FT_UShort*)(void*)( ~0UL )
>
>I don't have the compiler in question, so the only way for me to test is
>commit the change to VTK CVS then wait for the next automated nightly
>build.  :(
>
>Anyone here have Visual Studio?

Yes, any particular version required ?


             Ken


"Sean McBride" <address@hidden> wrote:

> On 1/9/10 6:40 AM, Werner LEMBERG said:
> 
> >What about a double cast?
> >
> >  #define ALL_POINTS  (FT_UShort*)(void*)( -1 )
> >
> >Since NULL is normally defined as `(void*)0' I can imagine that the 
> >above works.  Can you try this, please?
> 
> That did not work. :( The warning only changed to:
> 
> warning C4306: 'type cast' : conversion from 'int' to 'void *' of 
> greater size

Does it work better this way:

#define ALL_POINTS  (FT_UShort*)(void*)( ~0 )

or

#define ALL_POINTS  (FT_UShort*)(void*)( ~0UL )

?

--
Dmitry.


_______________________________________________
Freetype-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/freetype-devel




reply via email to

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