From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,76b62d6ecdceb3c4 X-Google-Attributes: gid1164f8,public From: Larry W Loen Subject: Re: 32 and 64 bit questions (some results) Date: 1999/11/15 Message-ID: <38308B37.B50CBAFF@rchland.vnet.ibm.com>#1/1 X-Deja-AN: 549028632 Content-Transfer-Encoding: 7bit References: <38220B81.B04EC3EE@rchland.vnet.ibm.com> To: Hal Murray Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.rchland.ibm.com X-Trace: news.rchland.ibm.com 942705448 35222 9.5.66.93 (15 Nov 1999 22:37:28 GMT) Organization: IBM Rochester MN Mime-Version: 1.0 NNTP-Posting-Date: 15 Nov 1999 22:37:28 GMT Newsgroups: comp.sys.dec I am happy to acknowledge the contributions to my little quest from Hall Murray of DEC/COMPAQ and to further confirm the postings of Robert Harley and Jeff Donsbach on the various options supported by DEC Alpha systems and their C/C++ compilers. A simple little program, run by Hal, produced the following results. Note that the results assume a fixed width font and that "#define" means the compiler predefines the macro variable and "#undef" means the compiler does not predefine the macro variable. Note also that the GNU results may not be 100% standard. GNU's macro variables are controlled by whomever did the port. These results may be universal across the DEC COMPAQ world or it may not. I have GNUs available to me that put a single underscore before the CPU architecture name. However, it does look like __alpha can be relied upon very universally. #define #undef GNU C __alpha __alpha__ __GNUC__ __32BITS __initial_pointer_size GNU C++ __cplusplus __alpha __alpha__ __GNUC__ __32BITS __initial_pointer_size DEC C __alpha __ALPHA __DECC_VER __32BITS __initial_pointer_size DEC C++ (unavailable) In all cases, sizeof(int)==4 bytes sizeof(long)== 8 bytes and sizeof(void*) is the natural size. I realize this is breathtakingly obvious to some folks, but remember that I all had was inconsisent (and some of it old/obsolete??) documentation. Or, maybe I just can't read ;-). Only DEC C seems to support a "-taso_short" option for a 32 bit address space at all and its only known effect is to set sizeof(void*) to 4. Long remains at 8 bytes in all known cases. None of the "known" macro variables relating to 32 versus 64 seem to be set by any of the compilers. By "known" I mean "seen in an on-line manual I tracked down with Northern Lights search engine." Perhaps those few hardies who want a 32 bit application memory space are expected to pass in some -D value of their own devising on their make files that passs in the -taso_short option? The program used to produce these results is as follows: ------- compdebug.c or compdebug.cpp #include int main() { printf("sizeof(int) %d ",((sizeof(int)))); printf("sizeof(long) %d sizeof(void*) %d\n", (sizeof(long)), (sizeof(void*))); #ifdef __cplusplus printf("__cplusplus\n"); #endif #ifdef __alpha printf("__alpha\n"); #endif #ifdef __alpha__ printf("__alpha__\n"); #endif #ifdef _alpha printf("_alpha\n"); #endif #ifdef __ALPHA printf("__ALPHA\n"); #endif #ifdef __ALPHA__ printf("__ALPHA__\n"); #endif #ifdef __DECC_VER printf("__DECC_VER %d\n", __DECC_VER); #endif #ifdef __DECCXX_VER printf("__DECCXX_VER %d\n", __DECCXX_VER); #endif #ifdef __GNUC__ printf("__GNUC__\n"); #endif #ifdef __initial_pointer_size printf("__initial_pointer_size %d\n", __initial_pointer_size); #endif #ifdef __32BITS printf("__32BITS\n"); #endif return 0; } ------- end compdebug.c or .cpp