freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] integer suffix abuse


From: Werner LEMBERG
Subject: Re: [ft-devel] integer suffix abuse
Date: Wed, 24 Jun 2015 18:56:06 +0200 (CEST)

> I think we abuse the suffix L in integer constants.  I understand the
> desire to make sure that very common 0x10000L is 32-bit to represent
> a unit in 16.16 fixed-point representation.  On modern 64-bit systems
> that actually becomes an unnecessary 64-bit constant.  Perhaps the
> suffix was used with 16-bit systems in mind, but 0x10000 cannot fit
> into 16-bit integer and will always be 32-bit even on 16-bit
> systems.

As far as I know, the `L' suffix simply gives an `at least' size of
32bit.  It does *not* enforce a 64bit value.  To do this, you need the
`LL' suffix.

Consequently, having `L' is harmless on 32bit and 64bit compilers, and
essential on 16bit compilers (you get warnings without it).
Admittedly, the latter is virtually extinct, and no-one is testing
FreeType compilation with such a compiler anymore, but please have in
mind that some parts of the TrueType specification actively use 16bit
integer overflow.  Similarly, FreeType uses `short int' here and
there, and IMHO it makes sense to have `L' for such situations.


    Werner



reply via email to

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