Mail Archives: djgpp/1998/01/20/14:13:47
A. Jans-Beken wrote:
> I believe that in C an int is defined as the default width of an
> internal register in the CPU. Therefore, in the history of 16 bit
> CPU's
> ints were by default 16 bits. On these old implementations of C a long
> always has been 32 bit.
ANSI says that "a 'plain' int object has the natural size suggested by
the architecture of the execution environment" (ANSI 6.1.2.5), and must
be at least 16 bits (ANSI 5.2.4.2.1). Also, short must be at least 16
bits, and long must be at least 32 bits. A char, in addition, must be
at least 8 bits (all ANSI 5.2.4.2.1).
> I never actually USED long long int. Maybe you should write a short
> test
> program to see what can and what can't be done.
> While you're at it -> please let me know the results :)
He should look to the `info' pages on gcc for more information. Namely,
in the section on "C Extensions":
GNU C supports data types for integers that are twice as long as
`long int'. Simply write `long long int' for a signed integer, or
`unsigned long long int' for an unsigned integer. To make an
integer constant of type `long long int', add the suffix `LL' to the
integer. To make an integer constant of type `unsigned long long
int', add the suffix `ULL' to the integer.
You can use these types in arithmetic like any other integer types.
Addition, subtraction, and bitwise boolean operations on these types
are open-coded on all types of machines. Multiplication is
open-coded if the machine supports fullword-to-doubleword a widening
multiply instruction. Division and shifts are open-coded only on
machines that provide special support. The operations that are not
open-coded use special library routines that come with GNU CC.
--
Erik Max Francis, &tSftDotIotE / mailto:max AT alcyone DOT com
Alcyone Systems / http://www.alcyone.com/max/
San Jose, California, United States / icbm://+37.20.07/-121.53.38
\
"Life may be / the product of imperfections."
/ (Marclo Gleiser)
- Raw text -