[CMake] 64bit programming

Hendrik Sattler post at hendrik-sattler.de
Sat Aug 23 05:04:16 EDT 2008


Am Samstag, 23. August 2008 02:34:35 schrieb Matthew Woehlke:
> Darren Weber wrote:
> > What are the traps and tricks for 64bit programming with CMake and other
> > kitware libraries?
>
> Don't make assumptions about sizeof(long) or sizeof(void*)... not even
> that they are the same (Microsoft, in their infinite wisdom, decided -
> as usual - to be different from everyone else and adopt a P64 model,
> rather than LP64 used by *everyone* else). That's the big thing. I don't
> know about kitware libraries, but I wouldn't expect much in the way of
> "gotchas" regarding 64-bit builds and cmake... at least, not on
> non-Windows platforms :-).

Usually, that should never be a problem as casting from long to a pointer and 
back is really good coding style in modern C (about the same as not differing 
between function/code pointer and data pointers).

Since google code has a project that gives msvc the C99 inttypes.h and 
stdint.h, those types should be used when a specific size is assumed. And 
when using int64_t, you don't have the problem of long only being 32bit and 
not 64bit.

HS


More information about the CMake mailing list