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: Alexei Podtelezhnikov
Subject: Re: [ft-devel] integer suffix abuse
Date: Wed, 24 Jun 2015 13:39:18 -0400

On Wed, Jun 24, 2015 at 12:56 PM, Werner LEMBERG <address@hidden> wrote:
>
>> 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.

No, standards define L as at least "long", which is 64-bit on linux x86_64.

>
> Consequently, having `L' is harmless on 32bit and 64bit compilers, and
> essential on 16bit compilers (you get warnings without it).

0x10000 does not fit 16 bit so it is at least 32-bit no matter what.
Indeed 0xFFFF has to be be decorated with L to guarantee 32-bit.

Perhaps, when these constants are used for initialization compilers
will do the right thing and Graham is right. The harm might be
hypothetical.



reply via email to

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