Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* 32 and 64 bit questions
@ 1999-11-04  5:00 Larry W Loen
  1999-11-05  5:00 ` Robert Harley
  1999-11-15  5:00 ` 32 and 64 bit questions (some results) Larry W Loen
  0 siblings, 2 replies; 7+ messages in thread
From: Larry W Loen @ 1999-11-04  5:00 UTC (permalink / raw)


As you can tell by the company I work for, I don't
have much to do professionally with DEC systems.

But, I am a bit puzzled at some things I read and
have been told over the years about Alpha and
C/C++.

Particularly, exactly how elementary C scalars are 
"sizeof-ed" on DEC C/C++ compilers.

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.

For instance, the max and min for long are 32 bits
in limits.h for both C and C++ books.  That
says long is "always" 32 bits.

There's lots of talk in the C
manual about __intial_pointer_size and nothing
about long as other than 32 bits.

Yet, the __32BIT macro variable in the C++ manual selects
a mode where "long and pointer are both 32 bits"
(implying, perhaps, that long is 64 bits on Alpha).
There is a section about getting your data types right
which states pretty openly that long can be 64 bits
at least some of the time.  Yet, it also states
min and max consistent with 32 bits near as I can
tell.

I know things like int64 and int32 are available
via includes and so on, but what I want to know
is if something like this is accurate:

                  sizeof
Compiler    int   long    void*    Notes
DEC C        4     4      4 or 8   4 when __32BIT 
DEC C++ VMS  4   4 or 8   4 or 8   4 and 4 when __32BIT
                                   8 and 8 otherwise
DEC C++ Unix 4     4      4        __32BIT is defined??

(where DEC C++ Unix means "the target is Unix").

Will a compile targeting Unix always define __32BIT?

BTW, do VAX compiles always set __32BIT now for C/C++?

Are the long LONGMIN and LONGMAX set right if long is allowed
to be 64 bits?

I am guestimating that predefined macro variables are:

DEC C   __intitial_pointer_size 
     defined when 64 bit pointers possible
     undefined when __32BITS is defined

DEC C++  __32BITS when long and void* always 64 bits.
         C++ does not seem to allow any 32 and 64 mixed 
         mode where pointers can be sometimes 32 and
         other times 64.
         
and that I would do something like:

#ifdef __DECCXX_VER
 #ifdef __ALPHA  /* meaning VMS and not Unix */
  #ifdef __32BITS
     #define SIZEOFLONG 4
     #define SIZEOFVOIDSTAR 4
  #else
     #define SIZEOFLONG 8
     #define SIZEOFVOIDSTAR 8
  #endif /* __32BITS */ 
 #else
     #define SIZEOFLONG 4
     #define SIZEOFVOIDSTAR 4
 #endif  /* __ALPHA */
#endif   /* DEC C */

#ifdef __DECC_VER
 #define SIZEOFLONG 4
 #ifdef __initial_pointer_size
    #define SIZEOFVOIDSTAR __initial_pointer_size
 #else
    #define SIZEOFVOIDSTAR 4
 #endif /* __initial_pointer_size */
#endif /* DEC C++ */

to find out about the sizes of any particular
environment my code found itself in.

BTW, what rules does GNU for Alpha follow?

Disclaimer:  I certainly don't want any 
proprietary stories on this, just a 
simple explanation of how things are.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1999-11-15  5:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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     ` bdwheele
1999-11-09  5:00     ` Jeff Donsbach
1999-11-11  5:00       ` Larry Loen
1999-11-15  5:00 ` 32 and 64 bit questions (some results) Larry W Loen

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