Re: Proposal: New types in C++0x
From: David Hilsee (davidhilseenews_at_yahoo.com)
Date: 09/22/04
- Next message: William Payne: "Re: Issue with CODE !!"
- Previous message: Rohan Seth: "Re: Issue with CODE !!"
- In reply to: Ioannis Vranos: "Proposal: New types in C++0x"
- Next in thread: Jack Klein: "Re: Proposal: New types in C++0x"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 21 Sep 2004 21:39:17 -0400
"Ioannis Vranos" <ivr@guesswh.at.grad.com> wrote in message
news:ciqc9o$1fi7$1@ulysses.noc.ntua.gr...
> 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?
>
>
>
>
> 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.
>
> 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.
>
> int32 is introduced and holds exactly 32-bit values. long becomes
> another name of it, as was the case with the above.
>
> 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.
>
>
> So we can say:
>
> int64 x;
>
> vector<int32> someVector;
>
> list<unsigned int64> someList;
>
>
> int32 *p = new int32[10];
>
> long *pp = p;
Wouldn't imposing exact requirements on existing types potentially cause
incompatibility problems? If, for example, there exists a platform that
makes int a 32-bit value (which would include many platforms, I reckon),
then replacing int's representation with a 16 bit representation would break
old programs. I think it's best to define more specific types like int16,
int32, and int64, leave the other types alone, and let programs use the new
types as they are needed. That way, explicit representations are only used
as they are required. I believe this is the approach taken by the new C
standard, but I could be wrong.
-- David Hilsee
- Next message: William Payne: "Re: Issue with CODE !!"
- Previous message: Rohan Seth: "Re: Issue with CODE !!"
- In reply to: Ioannis Vranos: "Proposal: New types in C++0x"
- Next in thread: Jack Klein: "Re: Proposal: New types in C++0x"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|