comp.lang.ada
 help / color / mirror / Atom feed
From: "REH" <spamjunk@stny.rr.com>
Subject: Re: Type safety, C++ and code generation
Date: 27 Apr 2006 07:47:49 -0700
Date: 2006-04-27T07:47:49-07:00	[thread overview]
Message-ID: <1146149268.981471.31810@j33g2000cwa.googlegroups.com> (raw)
In-Reply-To: <e2qj9l$edt$1@sunnews.cern.ch>


Maciej Sobczak wrote:
> REH wrote:
>
> >>http://www.msobczak.com/prog/typegen/
>
> > You maybe interested in a C++ class that I wrote.
>
> Been there, done that:
>
> http://www.msobczak.com/prog/downloads.html
>
> (see safetypes.tar.gz and range.tar.gz)
>
> I have dropped this idea because I think that the external code
> generator is much more flexible and more powerful with regard to the
> type safety that can be gained. Range checking is just one little part
> of what is needed. Template classes are fine if you can afford limiting
> yourself only to this little part, but that's not usually the case.
>
>
> --
I just took a look at the code to pointed to above.  It is much
different then mine:
1) yours allows for undefined behavior by not checking for overflows
before doing the operations.
2) yours does not eliminate unnecessary checks.
3) yours does not allow intermidate results to exceed the bounds of the
range.  For example, given a variable x, with a range of [0, 100],
yours will fail on x = (x * 1000) / 1000, mine will not.
4) yours does not allow for types larger than long, such as unsigned
long or implementation-specific types such as long long.
5) yours does not check for division-by-zero.

Think you are being dismissive without even looking at it.
REH




  parent reply	other threads:[~2006-04-27 14:47 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 [this message]
2006-04-27 15:10     ` REH
2006-04-28  6:22       ` Maciej Sobczak
replies disabled

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