comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <no.spam@no.spam.com>
Subject: Re: Type safety, C++ and code generation
Date: Fri, 28 Apr 2006 08:22:25 +0200
Date: 2006-04-28T08:22:25+02:00	[thread overview]
Message-ID: <e2scb1$9hk$1@sunnews.cern.ch> (raw)
In-Reply-To: <1146150613.238540.89130@t31g2000cwb.googlegroups.com>

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/



      reply	other threads:[~2006-04-28  6:22 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-27 10:35 Type safety, C++ and code generation Maciej Sobczak
2006-04-27 13:19 ` REH
2006-04-27 14:08   ` Maciej Sobczak
2006-04-27 14:33     ` REH
2006-04-27 15:16       ` Maciej Sobczak
2006-04-27 15:39         ` Georg Bauhaus
2006-04-28  5:57           ` Maciej Sobczak
2006-04-28 12:16             ` Georg Bauhaus
2006-04-28 12:37               ` brian.b.mcguinness
2006-04-28 17:04                 ` Georg Bauhaus
2006-04-28 18:50                 ` Jeffrey R. Carter
2006-04-28 19:07                   ` Randy Brukardt
2006-04-28 19:46                     ` Robert A Duff
2006-04-28 19:55                   ` Dmitry A. Kazakov
2006-04-29 21:28               ` Florian Weimer
2006-04-27 16:05         ` REH
2006-04-28  6:17           ` Maciej Sobczak
2006-04-30 14:40         ` adaworks
2006-04-30 15:23           ` REH
2006-04-30 18:14         ` Martin Krischik
2006-05-02  6:27           ` Maciej Sobczak
2006-05-02 13:33             ` REH
2006-05-02 15:05               ` Maciej Sobczak
2006-05-02 15:54                 ` REH
2006-05-02 16:50               ` Martin Krischik
2006-05-02 19:50                 ` REH
2006-04-27 14:47     ` REH
2006-04-27 15:10     ` REH
2006-04-28  6:22       ` Maciej Sobczak [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox