Boost logo

Boost :

Subject: Re: [boost] [contract] toward N3351 concepts
From: Evgeny Panasyuk (evgeny.panasyuk_at_[hidden])
Date: 2012-10-08 20:48:26


09.10.2012 3:12, Lorenzo Caminiti wrote:
> Because if the primary role of axioms is to state concept's semantics
> then I'd expect them to be used to enforce concept's semantics (with
> some type of compile-time checking) instead than using them for some
> optimization that BTW is going to be compiler-specific.

I don't see big problems with some degree of optimizations which are
done by one compiler but not by another.
We already have copy-elision which works better on some compilers than
on others.

> You standardize axioms but how would you standardize the optimization that
> a compilers will generate based on them? If such optimization cannot
> be standardized (I don't think it can) and if that is the main reason
> for axioms, why are axioms standardized?

I agree, and I wrote earlier, well-defined rules which kind of
transformations are allowed based on axioms, should be clearly stated.
I don't think it is impossible task, but obviously not easy.

P.S. I just have wild idea - what about axioms for function's arguments?
i.e. not on types, but on values.
Maybe some kind of axiomatic_assert.
For instance that can be used to prevent pointers aliasing ("restrict"
keyword in C99):
void* memcpy( void* dest, const void* src, size_t count )
{
     axiomatic_assert( do_not_overlap(dest,src,count) );
     // ...
}

Best Regards,
Evgeny


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk