Topic: 64-bit integer


Author: Nicola Musatti <objectway@divalsim.it>
Date: Thu, 16 Aug 2001 16:37:36 GMT
Raw View
The definitions are in the <boost/cstdint.hpp> header, which is part of
the Boost Integer Library.

Best regards,
Nicola Musatti

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Ron Natalie <ron@sensor.com>
Date: Mon, 13 Aug 2001 18:32:59 GMT
Raw View

Attila Feher wrote:
>
> Martin von Loewis wrote:
> [SNIP]
> > If you want exactly 64 bits, you should use int64_t; if that is not
> > available, the compiler has no 64 bit type (which means that long long
> > must be wider than 64 bits).
,
>
> Where is this int64_t in the standard?  Or which standard is it in?  I'd
> like to use it, if it is standard...  Could you help me pointing to the
> place where it is described?
>

It's in C99, 7.18.1.1 Exact width integer types.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>
Date: Mon, 13 Aug 2001 18:32:49 GMT
Raw View
Attila Feher <Attila.Feher@lmf.ericsson.se> writes:

| Or which standard is it in?  I'd

ISO C99.

Not present in C++98.

--
Gabriel Dos Reis, dosreis@cmla.ens-cachan.fr

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: kanze@gabi-soft.de (James Kanze)
Date: Mon, 13 Aug 2001 19:10:37 GMT
Raw View
Martin von Loewis <loewis@informatik.hu-berlin.de> wrote in message
news:<j4snexuuf9.fsf@porthos.informatik.hu-berlin.de>...
> "P.J. Plauger" <pjp@dinkumware.com> writes:

> > The 1999 revision of the ISO C Standard, a.k.a. C99, requires the
> > type long long to be at least 64 bits. I suspect that will be a
> > better name to standardize on in C++ than __int64. Meanwhile, you
> > have to use a bit of ifdef logic to pick the appropriate
> > definition for your 64-bit type.

> If you want exactly 64 bits, you should use int64_t; if that is not
> available, the compiler has no 64 bit type (which means that long
> long must be wider than 64 bits).

In C99.  The C++ standard is based on C90, and doesn't include an
int64_t.  In practice, a lot of C compilers still do not implement all
of C99, either.  So Plauger's advice is at least partially correct for
C++ and practically, for C as well.

(I say partially correct, because he mentions ifdef.  A better
solution, IMHO, is to put all such declarations in a machine dependant
header file, in a separate directory per machine, and control which
one you see by means of a -I option to the compiler.)

--
James Kanze                                   mailto:kanze@gabi-soft.de
Beratung in objektorientierer Datenverarbeitung --
                             -- Conseils en informatique orient   e objet
Ziegelh   ttenweg 17a, 60598 Frankfurt, Germany, T   l.: +49 (0)69 19 86 27

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Francis Glassborow <francis.glassborow@ntlworld.com>
Date: Mon, 13 Aug 2001 22:14:19 GMT
Raw View
In article <3B777AD3.21848DD8@lmf.ericsson.se>, Attila Feher
<Attila.Feher@lmf.ericsson.se> writes
>Martin von Loewis wrote:
>[SNIP]
>> If you want exactly 64 bits, you should use int64_t; if that is not
>> available, the compiler has no 64 bit type (which means that long long
>> must be wider than 64 bits).
>
>Hi,
>
>Where is this int64_t in the standard?  Or which standard is it in?  I'd
>like to use it, if it is standard...  Could you help me pointing to the
>place where it is described?

It isn't part of C++, it is part of the new facilities in C99.



Francis Glassborow      ACCU
64 Southfield Rd
Oxford OX4 1PA          +44(0)1865 246490
All opinions are mine and do not represent those of any organisation

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Nicola Musatti <objectway@divalsim.it>
Date: Tue, 14 Aug 2001 16:06:47 GMT
Raw View

Attila Feher wrote:
[...]
> Where is this int64_t in the standard?  Or which standard is it in?  I'd
> like to use it, if it is standard...  Could you help me pointing to the
> place where it is described?

While int64_t is not in the C++ standard, the Boost people
(www.boost.org) provide in their libraries a C++ definition of this and
other C99 integral types.

Cheers,
Nicola Musatti

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Attila Feher <Attila.Feher@lmf.ericsson.se>
Date: Wed, 15 Aug 2001 17:00:34 GMT
Raw View
Nicola Musatti wrote:
[SNIP]
> While int64_t is not in the C++ standard, the Boost people
> (www.boost.org) provide in their libraries a C++ definition of this and
> other C99 integral types.
[SNIP]

That is good to know!  In which library is it?  (I know, slightly
off-topic, but probably it is not bad to
memorize/safe-for-future-reference the name of a useful library here).

Attila

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Francis Glassborow <francis.glassborow@ntlworld.com>
Date: Fri, 10 Aug 2001 09:58:44 GMT
Raw View
In article <3b72591e.8488015@news.inf.tu-dresden.de>, Immanuel Scholz
<immanuel.scholz@saxsys.de> writes
>Hi,
>
>this question may be asked before:
>
>why are there no 64-bit-integer in c++ standard? maybe a int64 class
>in the std-library? (or an template for any percision, if this is
>efficent possible?)

For the same reason that there is no 8-bit, 16-bit or 32-bit fundamental
type. C++ does not specify its fundamental types that way.

>
>would making the __int64 in VC and some other minor Compiler more
>portable...

Francis Glassborow      ACCU
64 Southfield Rd
Oxford OX4 1PA          +44(0)1865 246490
All opinions are mine and do not represent those of any organisation

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Martin von Loewis <loewis@informatik.hu-berlin.de>
Date: Mon, 13 Aug 2001 03:26:54 GMT
Raw View
"P.J. Plauger" <pjp@dinkumware.com> writes:

> The 1999 revision of the ISO C Standard, a.k.a. C99, requires the
> type long long to be at least 64 bits. I suspect that will be a better
> name to standardize on in C++ than __int64. Meanwhile, you have to
> use a bit of ifdef logic to pick the appropriate definition for your
> 64-bit type.

If you want exactly 64 bits, you should use int64_t; if that is not
available, the compiler has no 64 bit type (which means that long long
must be wider than 64 bits).

Regards,
Martin

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: John Nagle <nagle@animats.com>
Date: Mon, 13 Aug 2001 10:24:57 GMT
Raw View
Francis Glassborow wrote:
> For the same reason that there is no 8-bit, 16-bit or 32-bit
> fundamental type. C++ does not specify its fundamental types that
> way.

    That decision was originally made so that ANSI C could support
non-byte-oriented machines.  The main machines that needed that
support around 1980 were the DEC PDP-10 and the
UNIVAC 1100 lines, both with 36-bit words.

    This feature is still required in C++ to support the UNISYS OS
2200 mainframes, the last 36-bit machines still manufactured.  These
are still sold; the Swedish National Road Administration ordered one
in April 2001.  This is the longest running series of CPUs in computer
history, with a compatible legacy back to the Electronic
Research Associates ERA 1101, in 1951, the first commercially
produced computer.  We thus have a half century of backwards
compatibilitiy.


     John Nagle
     Animats

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Attila Feher <Attila.Feher@lmf.ericsson.se>
Date: Mon, 13 Aug 2001 15:20:26 GMT
Raw View
Martin von Loewis wrote:
[SNIP]
> If you want exactly 64 bits, you should use int64_t; if that is not
> available, the compiler has no 64 bit type (which means that long long
> must be wider than 64 bits).

Hi,

Where is this int64_t in the standard?  Or which standard is it in?  I'd
like to use it, if it is standard...  Could you help me pointing to the
place where it is described?

TIA, Attila

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: comeau@panix.com (Greg Comeau)
Date: Mon, 13 Aug 2001 18:31:24 GMT
Raw View
In article <j4snexuuf9.fsf@porthos.informatik.hu-berlin.de>,
Martin von Loewis  <loewis@informatik.hu-berlin.de> wrote:
>"P.J. Plauger" <pjp@dinkumware.com> writes:
>> The 1999 revision of the ISO C Standard, a.k.a. C99, requires the
>> type long long to be at least 64 bits. I suspect that will be a better
>> name to standardize on in C++ than __int64. Meanwhile, you have to
>> use a bit of ifdef logic to pick the appropriate definition for your
>> 64-bit type.
>
>If you want exactly 64 bits, you should use int64_t; if that is not
>available, the compiler has no 64 bit type (which means that long long
>must be wider than 64 bits).

Yes, but we're talking about C++ using C99 as an example.
IOWs, C++ has no int64_t, but that doesn't mean that it has no
64 bit type.
--
Greg Comeau                 Countdown to "export": December 1, 2001
Comeau C/C++ ONLINE ==>     http://www.comeaucomputing.com/tryitout

Tasty C99/C++ Combo: Dinkumware libs + Comeau Compilers == WOW!!!

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: immanuel.scholz@saxsys.de (Immanuel Scholz)
Date: Thu, 9 Aug 2001 11:33:58 GMT
Raw View
Hi,

this question may be asked before:

why are there no 64-bit-integer in c++ standard? maybe a int64 class
in the std-library? (or an template for any percision, if this is
efficent possible?)

would making the __int64 in VC and some other minor Compiler more
portable...


Immanuel Scholz

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: James Dennett <jdennett@acm.org>
Date: Thu, 9 Aug 2001 18:26:35 GMT
Raw View
Immanuel Scholz wrote:
> Hi,
>
> this question may be asked before:
>
> why are there no 64-bit-integer in c++ standard?

For the same reason that there's no 8-bit integer, or 9-bit integer,
or 16-bit integer, or 32-bit integer, or indeed *any* fixed size
integer.  The C++ Standard intends to allow efficient implementations
on platforms which have varying hardware which might not naturally
support any core set of fixed-size integral types.

>  maybe a int64 class
> in the std-library? (or an template for any percision, if this is
> efficent possible?)

C90 also had no support for fixed-size types, but C99 added support
for optional fixed-size types (whose presence is signalled by macros)
and for type "long long" which is (I believe) guaranteed to be at
least 64 bits.  Similar changes are under consideration for inclusion
in a future C++ Standard.

-- James Dennett

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: "P.J. Plauger" <pjp@dinkumware.com>
Date: Thu, 9 Aug 2001 18:27:02 GMT
Raw View
"Immanuel Scholz" <immanuel.scholz@saxsys.de> wrote in message news:3b72591e.8488015@news.inf.tu-dresden.de...

> why are there no 64-bit-integer in c++ standard? maybe a int64 class
> in the std-library? (or an template for any percision, if this is
> efficent possible?)

The C++ Standard is based on the underlying C model described in the
C89 ANSI/C90 ISO C Standard, which has no basic integer type that is
required to be 64 bits. In practice, however, many compilers today
do indeed add such a type.

> would making the __int64 in VC and some other minor Compiler more
> portable...

I'll gloss over whether VC should be considered a ``minor compiler'' ...

The 1999 revision of the ISO C Standard, a.k.a. C99, requires the
type long long to be at least 64 bits. I suspect that will be a better
name to standardize on in C++ than __int64. Meanwhile, you have to
use a bit of ifdef logic to pick the appropriate definition for your
64-bit type.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com



---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Martin von Loewis <loewis@informatik.hu-berlin.de>
Date: Thu, 9 Aug 2001 18:26:58 GMT
Raw View
immanuel.scholz@saxsys.de (Immanuel Scholz) writes:

> why are there no 64-bit-integer in c++ standard?

In standard C++, the language does not say anything about the size of
the integral types. A compiler is free to define that, say, the 'long'
type is 64 bits, and many compilers do. The compiler even may say that
the 'int' type is 64 bits, but only few do.

> would making the __int64 in VC and some other minor Compiler more
> portable...

Many compilers with probably support the <inttypes.h> header in the
future, which will give you an int64_t.

Regards,
Martin

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: "James Russell Kuyper Jr." <kuyper@wizard.net>
Date: Thu, 9 Aug 2001 22:32:40 GMT
Raw View
Immanuel Scholz wrote:
>
> Hi,
>
> this question may be asked before:
>
> why are there no 64-bit-integer in c++ standard? maybe a int64 class
> in the std-library? (or an template for any percision, if this is
> efficent possible?)

Like the original C standard, the C++ standard does not specify specific
sizes for types, because it was felt inappropriate to force implementors
to support types that might be inefficient on a particular platform. The
largest minimum size it specifies corresponds to a 32-bit type, since
that was the largest widely supported type at the time the original C
standard was approved.

However, C99 added types that have to be at least 64 bits, and also
added size named types in <stdint.h>. I think you're likely to see both
features added as extensions to most C++ implementations, particularly
for any implementation that shares a lot of code with a C compiler. A
C99 implementor can easily arrange it so that the <stdint.h> is
completely compatible with a version of C++ provided by the same
implementor, while still meeting its C99 requirements in a C++ context.
If so, you'll have a choice of several different types, each of which
has at least 64 bits:

long long: Has at least 64 bits.
int64_t: Exactly 64 bits (optional, allowing implementation
 of C99 on systems where no hardware type is exactly 64 bits)
int_least64_t: Smallest type with at least 64 bits.
int_fast64_t: Fastest type with at least 64 bits.
int*N_t (N>64): Optional

There's no guarantee, but a pretty high probability that some version of
this will be part of the next C++ standard. Still, it's been argued that
a templated type would be a more appropriate for C++.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Ron Natalie <ron@sensor.com>
Date: Thu, 9 Aug 2001 22:46:10 GMT
Raw View

Immanuel Scholz wrote:

> why are there no 64-bit-integer in c++ standard?

There are no specific integer sizes in the C++ (or C) standards
at all.  It always has been the case that it was up to the implemenation
to map the various types to something that made sense on the particular
implementation.  About the best you get are some assurances about
minimum sizes.

> maybe a int64 class
> in the std-library? (or an template for any percision, if this is
> efficent possible?)

If it is going to exist at all, it better be required to be there.
Making it conditional on whether it is easy for the implementation
to do or not, is no better portability wise than omitting it entirely.

>
> would making the __int64 in VC and some other minor Compiler more
> portable...
>

The C 99 standard however does provde additional declarations of this
sort in stdint.h.  It might be expected that this is a good candidate
for future propagation to C++.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: comeau@panix.com (Greg Comeau)
Date: Thu, 9 Aug 2001 22:48:43 GMT
Raw View
In article <3B727B66.8020308@acm.org>, James Dennett  <jdennett@acm.org> wrote:
>C90 also had no support for fixed-size types, but C99 added support
>for optional fixed-size types (whose presence is signalled by macros)
>and for type "long long" which is (I believe) guaranteed to be at
>least 64 bits.  Similar changes are under consideration for inclusion
>in a future C++ Standard.

Just to be clearer: Nobody yet know what will be in the next
revision to Standard C++.  Most likely, the C99 features will
be on the list of things that will be look at, but in the
end they may not be accepted for C++.
--
Greg Comeau                 Countdown to "export": December 1, 2001
Comeau C/C++ ONLINE ==>     http://www.comeaucomputing.com/tryitout

Tasty C99/C++ Combo: Dinkumware libs + Comeau Compilers == WOW!!!

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]