Re: Type safety, C++ and code generation
- From: "REH" <spamjunk@xxxxxxxxxxx>
- Date: 27 Apr 2006 07:47:49 -0700
Maciej Sobczak wrote:
REH wrote:I just took a look at the code to pointed to above. It is much
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.
--
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
.
- 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
- Type safety, C++ and code generation
- Prev by Date: Re: Type safety, C++ and code generation
- Next by Date: Re: Type safety, C++ and code generation
- Previous by thread: Re: Type safety, C++ and code generation
- Next by thread: Re: Type safety, C++ and code generation
- Index(es):