Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: Larry W Loen <lwloen@rchland.vnet.ibm.com>
To: Hal Murray <murray@pa.dec.com>
Subject: Re: 32 and 64 bit questions (some results)
Date: 1999/11/15	[thread overview]
Message-ID: <38308B37.B50CBAFF@rchland.vnet.ibm.com> (raw)
In-Reply-To: 38220B81.B04EC3EE@rchland.vnet.ibm.com

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 <stdio.h>

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



      parent reply	other threads:[~1999-11-15  5:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-04  5:00 32 and 64 bit questions Larry W Loen
1999-11-05  5:00 ` Robert Harley
1999-11-06  5:00   ` Larry Loen
1999-11-09  5:00     ` Jeff Donsbach
1999-11-11  5:00       ` Larry Loen
1999-11-09  5:00     ` bdwheele
1999-11-15  5:00 ` Larry W Loen [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox