Re: Type safety, C++ and code generation
- From: Maciej Sobczak <no.spam@xxxxxxxxxxx>
- Date: Fri, 28 Apr 2006 08:22:25 +0200
REH wrote:
your logic is also flawed in that it will
not detect overflows
Because it's not within the responsibilities of the class that is supposed to implement ranges.
The overflow is what happens (or not!) on the level of the underlying type.
If this has the overflow problems:
typedef range<int, 0, 100> R;
then the solution to those problems is this:
typedef range<my_int_with_overflow_protection, 0, 100> R;
or this:
typedef range<big_int, 0, 100> R;
or even this:
typedef range<overflow_protected<int>, 0, 100> R;
and so on - but whatever it is, it's not within the responsibilities of the range<T> class, which is only supposed to implement ranges on top of some given underlying type.
--
Maciej Sobczak : http://www.msobczak.com/
Programming : http://www.msobczak.com/prog/
.
- References:
- Type safety, C++ and code generation
- From: Maciej Sobczak
- Re: Type safety, C++ and code generation
- From: REH
- Re: Type safety, C++ and code generation
- From: Maciej Sobczak
- Re: Type safety, C++ and code generation
- From: REH
- Type safety, C++ and code generation
- Prev by Date: Re: Type safety, C++ and code generation
- Next by Date: Re: where exactly c++,c fail and Ada gets thru'
- Previous by thread: Re: Type safety, C++ and code generation
- Next by thread: re: OO vs procedural
- Index(es):