64 bit architectures and C/C++

Phil Howard KA9WGN phil at ux1.cso.uiuc.edu
Sun May 5 06:24:38 AEST 1991


What would be the best way to do this:

I want to pass around integer numbers that I know will require more than
32 bits but not more than 63 bits.  An example of such a number of the
number of microseconds in the century.  The uses include passing them to
functions as arguments and receiving them back as return values.

I want to specify it sufficiently that a reasonable implementation on a 64 bit
machine will in fact use the 64 bit integer instructions.  Whatever way it
is to be specified should work on all such 64 bit machines.

If I were to use an array of smaller integers, I'd have to code specific
macros or functions to apply operations to these values that would be more
preferrable to do as simple arithmetic operations.  But the big deal is that
a 64-bit machine would not get to use its 64-bit capabilities.  It does no
good to get a 64-bit machine if it is just going to be doing 32-bit data
operations all the time.

But of course I want to do it portable within the scope of 64 bit machines.

Shouldn't "long" always represent at least the longest natural operation
width on the given architecture, so that it is at least POSSIBLE to code
applications that need that architecture?

(I am speaking in terms of current and future directions in C, not in
compatibility of old code, which is a separate issue)
-- 
 /***************************************************************************\
/ Phil Howard -- KA9WGN -- phil at ux1.cso.uiuc.edu   |  Guns don't aim guns at  \
\ Lietuva laisva -- Brivu Latviju -- Eesti vabaks  |  people; CRIMINALS do!!  /
 \***************************************************************************/



More information about the Comp.lang.c mailing list