comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <no.spam@no.spam.com>
Subject: Re: where exactly c++,c fail and Ada gets thru'
Date: Thu, 27 Apr 2006 12:07:49 +0200
Date: 2006-04-27T12:07:49+02:00	[thread overview]
Message-ID: <e2q55k$erp$1@sunnews.cern.ch> (raw)
In-Reply-To: <1235818.stAph9vF03@linux1.krischik.com>

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/



  reply	other threads:[~2006-04-27 10:07 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-24  4:19 where exactly c++,c fail and Ada gets thru' Ananth the Boss
2006-04-24  5:05 ` jimmaureenrogers
2006-04-24  7:45   ` Ananth the Boss
2006-04-24 19:17   ` Martin Krischik
2006-04-24 20:23   ` Simon Wright
2006-04-24 22:34     ` Keith Thompson
2006-04-24 22:33   ` Keith Thompson
2006-04-25  5:23     ` Jeffrey R. Carter
2006-04-26 17:48     ` Martin Krischik
2006-04-26 19:33       ` Keith Thompson
2006-04-26 15:10   ` Maciej Sobczak
2006-04-26 17:32     ` Martin Krischik
2006-04-27 10:07       ` Maciej Sobczak [this message]
2006-04-27 21:19         ` Keith Thompson
2006-04-28  7:00         ` Martin Krischik
2006-04-28 12:27           ` Maciej Sobczak
2006-04-29  7:03             ` Martin Krischik
2006-04-29 14:08               ` REH
2006-05-01 10:20                 ` Xcriber51
2006-05-01 13:55                   ` REH
2006-05-02  6:43               ` Maciej Sobczak
2006-04-27 16:48       ` REH
2006-04-28  7:49         ` Martin Krischik
2006-04-28 11:17           ` REH
2006-04-29  6:47             ` Martin Krischik
2006-04-24  8:13 ` Rod Chapman
2006-04-25  1:57 ` Steve
replies disabled

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