Re: Proposal: New types in C++0x
From: Jack Klein (jackklein_at_spamcop.net)
Date: 09/22/04
- Next message: Victor Bazarov: "Re: Migrating from Borland OWL to something more up-to-date"
- Previous message: Jack Klein: "Re: NEW STEP IN THE FIGHT AGAINST SOFTWARE PIRACY"
- In reply to: Ioannis Vranos: "Proposal: New types in C++0x"
- Next in thread: Peter van Merkerk: "Re: Proposal: New types in C++0x"
- Reply: Peter van Merkerk: "Re: Proposal: New types in C++0x"
- Reply: Pete Becker: "Re: Proposal: New types in C++0x"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 21 Sep 2004 23:07:58 -0500
On Wed, 22 Sep 2004 02:08:41 +0300, Ioannis Vranos
<ivr@guesswh.at.grad.com> wrote in comp.lang.c++:
> Since there is the need of a new 64-bit integer type, the approach taken
> should be extensible.
>
> What about introducing int64 being exactly 64 bit, int32 being exactly
> 32 bits and int16 being exactly 16 bits, and making short and int
> equivalent to int16, and long being equivalent to int32?
Gee, you are only some 5 years behind the times, since the October,
1999 adoption of ISO 9899:1999 Programming Languages -- C.
Your proposal is actually poorly thought out and harmful. What of
platforms that don't have 16-bit objects at all? There are some, you
know, and C++ compilers for some of them.
> My proposal more thoroughly:
>
> int16 is introduced and is an exact 16-bit type (of course additional
> padding bits are allowed). int and short become equivalent of it.
If it has padding bits, it is not an exact-width 16-bit type.
> That is, signed int16, int16, signed, signed int, int, signed short,
> short to be all equivalent. The same for the unsigned equivalents. That
> is unsigned int16 to be the same as unsigned int and unsigned, etc.
This would break an extremely large amount of conforming, if not
strictly portable, code that expects ints to be at least 32 bits.
There are millions of lines of such code in existence in working
programs where portability to 16-bit platforms is not considered
important.
> int32 is introduced and holds exactly 32-bit values. long becomes
> another name of it, as was the case with the above.
On at least some 64-bit processor implementations, (un)signed long
will be 64 bits.
> signed int32, int32, signed long, long are all the same.
>
> unsigned long is another name of unsigned int32.
>
>
> int64 is introduced and holds 64-bit values. signed int64 is equivalent
> and unsigned int64 is the unsigned type.
The original 1989 ANSI standard mentioned the already popular
extension 'long long' for an integer type with at least 64 bits. It
has been standardized in C for 5 years, and will be standardized, with
that name, in C++.
Do you actually think that both C and C++ have completely avoided
specifying exact representations for the integer types for 30 plus
years because nobody thought of it before you did? If you want
exactly specified sizes and ranges for all the arithmetic types, you
know where to find Java.
And for a portable and standardized method of providing ways to
specify integer types with various attributes, including such
exact-width types as an implementation can support, do a web search
for "stdint.h", part of standard C.
Finally, the place to propose new features for C++ is in the moderated
group news:comp.std.c++, not here. Read the FAQ first, of course.
-- Jack Klein Home: http://JK-Technology.Com FAQs for comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html comp.lang.c++ http://www.parashift.com/c++-faq-lite/ alt.comp.lang.learn.c-c++ http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
- Next message: Victor Bazarov: "Re: Migrating from Borland OWL to something more up-to-date"
- Previous message: Jack Klein: "Re: NEW STEP IN THE FIGHT AGAINST SOFTWARE PIRACY"
- In reply to: Ioannis Vranos: "Proposal: New types in C++0x"
- Next in thread: Peter van Merkerk: "Re: Proposal: New types in C++0x"
- Reply: Peter van Merkerk: "Re: Proposal: New types in C++0x"
- Reply: Pete Becker: "Re: Proposal: New types in C++0x"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|