This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [using gcc book] 5.20 double-word integers
- From: Gabriel Paubert <paubert at iram dot es>
- To: Chris Devers <cdevers at pobox dot com>
- Cc: GCC list <gcc at gcc dot gnu dot org>
- Date: Tue, 2 Sep 2003 00:56:59 +0000
- Subject: Re: [using gcc book] 5.20 double-word integers
- References: <Pine.OSX.4.56.0308232126560.8695@macdaddy.local> <20030826095248.GB7637@iram.es> <Pine.OSX.4.56.0308261045280.1141@macdaddy.local> <20030826174441.GA12461@iram.es> <Pine.OSX.4.56.0308261353500.1141@macdaddy.local> <Pine.OSX.4.56.0309011337020.9933@macdaddy.local>
On Mon, Sep 01, 2003 at 01:41:39PM -0400, Chris Devers wrote:
> Hello again, everyone. I'm finishing up the last round of revisions so
> that the _Using GCC_ manuscript can go out to the printer, which hopefully
> will happen tomorrow.
>
> Here's the first of a handful of last minute questions.
>
>
> On Tue, 26 Aug 2003, Chris Devers wrote:
>
> > On Tue, 26 Aug 2003, Gabriel Paubert wrote:
> >
> > > Finally, when rereading the whole "Double-word Integers" section,
> > > it seems obvious that it was written before the existence of 64 bit
> > > machines, in which registers are twice the size of an int, and often
> > > use exactly the same instructions for 32 and 64 bit operations.
> >
> > In which case, it's yet another section that could really do with a
> > complete rewrite from scratch to bring it more up to date.
> >
> > Barring that, I might just strengthen the note about how word length is
> > sensitive to the hardware you're dealing with, and it may be necessary
> > to refer to platform specific documentation for these things.
>
As a minimal patch I'd rather put the following, which gets rid
of the controversial section and eliminates the ambiguous
and/or misleading index references.
Now that the type is part of a standard, I believe that you don't
need to put as many details as in the preceding versions. After
all the only important part of this section now is that long
long integers are accepted as a GCC extension when compiling
in non C99 modes.
Gabriel
Index: extend.texi
===================================================================
RCS file: /usr/src/repositories/gcc-cvs/gcc/gcc/doc/extend.texi,v
retrieving revision 1.158
diff -c -r1.158 extend.texi
*** extend.texi 28 Aug 2003 22:00:45 -0000 1.158
--- extend.texi 2 Sep 2003 00:48:05 -0000
***************
*** 1180,1207 ****
effects of recomputing it.
@node Long Long
! @section Double-Word Integers
@cindex @code{long long} data types
- @cindex double-word arithmetic
- @cindex multiprecision arithmetic
@cindex @code{LL} integer suffix
@cindex @code{ULL} integer suffix
! ISO C99 supports data types for integers that are at least 64 bits wide,
and as an extension GCC supports them in C89 mode and in C++.
Simply write @code{long long int} for a signed integer, or
@code{unsigned long long int} for an unsigned integer. To make an
integer constant of type @code{long long int}, add the suffix @samp{LL}
to the integer. To make an integer constant of type @code{unsigned long
long int}, add the suffix @samp{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 GCC@.
There may be pitfalls when you use @code{long long} types for function
arguments, unless you declare function prototypes. If a function
--- 1180,1197 ----
effects of recomputing it.
@node Long Long
! @section Long Long Integers
@cindex @code{long long} data types
@cindex @code{LL} integer suffix
@cindex @code{ULL} integer suffix
! ISO C99 supports integer data types that are at least 64 bits wide,
and as an extension GCC supports them in C89 mode and in C++.
Simply write @code{long long int} for a signed integer, or
@code{unsigned long long int} for an unsigned integer. To make an
integer constant of type @code{long long int}, add the suffix @samp{LL}
to the integer. To make an integer constant of type @code{unsigned long
long int}, add the suffix @samp{ULL} to the integer.
There may be pitfalls when you use @code{long long} types for function
arguments, unless you declare function prototypes. If a function