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 Loen Subject: Re: 32 and 64 bit questions Date: 1999/11/06 Message-ID: <3824F582.855F31FA@rchland.vnet.ibm.com>#1/1 X-Deja-AN: 545415451 Content-Transfer-Encoding: 7bit References: <38220B81.B04EC3EE@rchland.vnet.ibm.com> To: Robert Harley Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.rchland.ibm.com X-Trace: news.rchland.ibm.com 941946167 25342 9.5.123.82 (7 Nov 1999 03:42:47 GMT) Organization: IBM Rochester MN Mime-Version: 1.0 Reply-To: lwloen, #, rchland.vnet.ibm.com NNTP-Posting-Date: 7 Nov 1999 03:42:47 GMT Newsgroups: comp.sys.dec Robert Harley wrote: > Larry W Loen writes: > > I was once told that the C construct "long" was > > supposed to be 64 bits for Alpha, but reading > > about the DEC C and DEC C++ compiler manuals on-line > > more or less contradicts it. > > Longs are 64 bits on Linux and Tru64 Unix, but 32 bits on VMS and > WinNT. I suspect they're 64 on BSD but I'm not certain. > > Rob. Thanks for the reply. It's helpful, but not enough for this poor fellow who has no machine available to settle it. There is a kind of incestual relationship between and operating system and a compiler. At the end of the day, however, the operating system really does not determine what "sizeof(int)" or "sizeof(long)" is. The compiler does. An OS may write its documentation "as if" it controlled these things. That means an OS interface may be written with sizeof(int) and sizeof(long) _presumed_ to be certain values, but the compiler, in the end, controls what is actually done. To be sure, the compiler has some good incentive to mimic the OS' rules, but it may or may not actually do so. Thus, the OS document can say that a given input value on a given interface is a "long" and mean "64 bit signed integer." But the compiler only need supply _some_ way of generating a 64 bit integer. It may define long as 32 and use either long long or something like __int64 for 64 bit binary numbers. I've seen it done. And, while the OS may happen to provide a compiler along with it that expresses its presumptions about what "sizeof(long)" should be, there are usually alternative compilers as well that may or may not have different rules. For instance, if most of my application was independent of the OS, and was first written for NT, I might use an Alpha-targeting Microsoft C/C++ or maybe a variant of GNU C created with MS conventions for all but the modules in my application that deal directly with the OS. Thus, my interest is really not just the OS rules, but how the compilers _implement_ them and what flags they turn on to indicate which rules are active. I'm very interested in what DEC C and C++ define and how they define them (e.g. what/when __32BITS is active and what OS flags and so on go with such a setting). I'm also a bit interested in MS C++ and GNU, but the DEC/COMPAQ are my first interest. So far as I can tell, the DEC C and C++ (and their COMPAQ-branded upgrades) seem to have different rules. At best, the on-line documentation is inconsistent and unclear on long. Still, I think I get some good answers from your note. I think I should expect the following: int long void* Microsoft C/C++ 4 4 8 **** DEC C/C++ 4 8 8 ** GNU 4 8 8 ** *** ** Unless running in __32BITS mode. Assumed same for 64 bit VMS and Tru64. *** I'm assuming that if Alpha Linux has a 64 bit long, it has a 64 bit void* ***** Since MS C++ only supported NT conventions but the DEC/COMPAQ documentation doesn't unambiguously support the above table nor provide a consistent way for telling what is what between its C and C++. Or, so I read it. Can you help me further?