Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: Larry Loen <lwloen@rchland.vnet.ibm.com>
To: Robert Harley <harley@corton.inria.fr>
Subject: Re: 32 and 64 bit questions
Date: 1999/11/06	[thread overview]
Message-ID: <3824F582.855F31FA@rchland.vnet.ibm.com> (raw)
In-Reply-To: rz74sf1w88n.fsf@corton.inria.fr

Robert Harley wrote:

> Larry W Loen <lwloen@rchland.vnet.ibm.com> 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?







  reply	other threads:[~1999-11-06  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 [this message]
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
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