[Interest] is QT_POINTER_SIZE safe when cross compiling?

roland at logikalsolutions.com roland at logikalsolutions.com
Tue Jan 29 00:32:46 CET 2019


Never mind, found it.

developer at developer-U18-64-VirtualBox:~/Qt/5.12.0/Src$ find . -name  
'*.h'  -exec grep -l 'define QT_POINTER_SIZE' {} \;
./qtbase/src/corelib/global/qprocessordetection.h
^C
developer at developer-U18-64-VirtualBox:~/Qt/5.12.0/Src$ browse  
qtbase/src/corelib/global/qprocessordetection.h


/*
    Size of a pointer and the machine register size. We detect a  
64-bit system by:
    * GCC and compatible compilers (Clang, ICC on OS X and Windows)  
always define
      __SIZEOF_POINTER__. This catches all known cases of ILP32 builds  
on 64-bit
      processors.
    * Most other Unix compilers define __LP64__ or _LP64 on 64-bit mode
      (Long and Pointer 64-bit)
    * If Q_PROCESSOR_WORDSIZE was defined above, it's assumed to match  
the pointer
      size.
    Otherwise, we assume to be 32-bit and then check in qglobal.cpp  
that it is right.
*/

#if defined __SIZEOF_POINTER__
#  define QT_POINTER_SIZE           __SIZEOF_POINTER__
#elif defined(__LP64__) || defined(_LP64)
#  define QT_POINTER_SIZE           8
#elif defined(Q_PROCESSOR_WORDSIZE)
#  define QT_POINTER_SIZE           Q_PROCESSOR_WORDSIZE
#else
#  define QT_POINTER_SIZE           4
#endif


As long as we are using GCC it should work.

Sorry to bother.
-- 
Roland Hughes, President
Logikal Solutions
(630) 205-1593

http://www.theminimumyouneedtoknow.com
http://www.infiniteexposure.net
http://www.johnsmith-book.com
http://www.logikalblog.com
http://www.interestingauthors.com/blog
http://lesedi.us




More information about the Interest mailing list