Re: where exactly c++,c fail and Ada gets thru'
- From: Maciej Sobczak <no.spam@xxxxxxxxxxx>
- Date: Thu, 27 Apr 2006 12:07:49 +0200
Martin Krischik wrote:
Now say we have a suitable C++ range template:
typedef range<int, 1, 10> Y_Type;
typedef range<Y_Type, 1, 5> X_Type;
Y_Type F (X_Type X)
{
return X + 3;
}
Y_Type G (X_Type X)
{
return X + 7;
}
Now anyone up to the challenge to define:
template <typename Base_Type, Base_Type First, Base_Type Last>
range::operator = (Base_Type right)
template <typename Base_Type, Base_Type First, Base_Type Last>
range::operator + (Base_Type right)
template <typename Base_Type, Base_Type First, Base_Type Last>
range::range (Base_Type right)
in such a way that it works like Ada - inclusive the *realistic* change that
the compiler will optimize away the range check in F ().
The C++ standard does not define to what extent the compilers are allowed to optimize the resulting code. This is the quality of implementation issue and an area of competition between compiler vendors. Without any further checks I can claim that it is possible for the compiler to optimize it the way you want.
And without any further checks I take the risk to claim that the Ada standard does not require any conforming compiler to optimize range checks away as you described (or please throw some references) - similarly, this is the QoI issue.
So - what was your point?
--
Maciej Sobczak : http://www.msobczak.com/
Programming : http://www.msobczak.com/prog/
.
- Follow-Ups:
- Re: where exactly c++,c fail and Ada gets thru'
- From: Martin Krischik
- Re: where exactly c++,c fail and Ada gets thru'
- From: Keith Thompson
- Re: where exactly c++,c fail and Ada gets thru'
- References:
- where exactly c++,c fail and Ada gets thru'
- From: Ananth the Boss
- Re: where exactly c++,c fail and Ada gets thru'
- From: jimmaureenrogers@xxxxxxxxxxxxxxxx
- Re: where exactly c++,c fail and Ada gets thru'
- From: Maciej Sobczak
- Re: where exactly c++,c fail and Ada gets thru'
- From: Martin Krischik
- where exactly c++,c fail and Ada gets thru'
- Prev by Date: Re: procedural vs object oriented
- Next by Date: Type safety, C++ and code generation
- Previous by thread: Re: where exactly c++,c fail and Ada gets thru'
- Next by thread: Re: where exactly c++,c fail and Ada gets thru'
- Index(es):
Relevant Pages
|