Boost logo

Ublas :

From: David Abrahams (dave_at_[hidden])
Date: 2005-06-25 19:40:41


Ian McCulloch <ianmcc_at_[hidden]> writes:

> David Abrahams wrote:
>
>> Michael Stevens <mail_at_[hidden]> writes:
>>
>>> Hi Jeff,
>>>
>>> On Monday 20 June 2005 16:07, Jeffrey McBeth wrote:
>>>> Not that I should get a vote (having just joined the list and started
>>>> using uBlas), but I'm all for the principle of least surprise. We
>>>> shouldn't have to flip a magic switch like alias() just to make the
>>>> algorithm work right. It should always work right. The current
>>>> no_alias paradigm is the right way to go.
>>>
>>> The problem now is that people are 'surprised' that either code is
>>> suboptimal with regard to speed and temporaries.
>>>
>>> I think it is hard to avoid surprises!
>>
>> If you're willing to have people be surprised that their object code is
>> large you can avoid the other two surprises.
>
> Can you explain more? Except for some simple cases, determining whether
> parameters are aliased cannot be done at compile-time, nor even an O(1)
> runtime test.

You can generate both versions of the code and detect the cases where
you can be sure there's no aliasing with a reasonably fast runtime
test.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com