[PATCH] QT 4.4.0-snapshot-20070420 [missing q_atomic_*]

Thiago Macieira thiago at kde.org
Mon Apr 23 15:54:32 BST 2007


Stefan Teleman said:
> On Monday 23 April 2007 09:28, Thiago Macieira wrote:
>
>> AMD-64 (x86-64) is an LP64 platform on Unix machines (Windows64 is
>> P64 only).
>
> Really ?

Yes. In fact, Microsoft even brags about it:
http://msdn2.microsoft.com/en-us/library/ms952405.aspx
"There is another data model called LP64 [...] This data model is common
on Unix platforms, but can make it harder to create both 32-bit and 64-bit
versions of your application from a single code base. You might notice a
common theme here."

ILP32 (traditional 32-bit):
sizeof(int) = sizeof(long) = sizeof(void*) = 4
sizeof(long long) = 8

LP64 (Unix 64-bit):
sizeof(int) = 4
sizeof(long) = sizeof(long long) = sizeof(void*) = 8

P64 or LLP64 (Windows 64-bit):
sizeof(int) = sizeof(long) = 4
sizeof(long long) = sizeof(void*) = 8

The MSVC compiler calls "long long" "_int64". To write 64-bit literal
constants, use the Q_INT64_C and Q_UINT64_C macros.

I don't know how gcc on Windows 64-bit works: does it use 64-bit longs or
not? I would in fact bet that it supports both modes, since Mingw should
choose the native style whereas Cygwin should choose the Unix style.

[Just since we're on the subject: sizeof(void (*)()) isn't guaranteed to
be equal to sizeof(void*) on any platform; what's more, sizeof(void
(ClassName::*)()) is almost always (always?) larger than a pointer]

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358






More information about the kde-core-devel mailing list