[std-interval] Mathematical relations and default initialization

Sylvain Pion Sylvain.Pion at sophia.inria.fr
Fri Sep 15 01:21:21 PDT 2006


Chenyi Hu wrote:
> Agree with George that there is no perfect answer. Not seeing explicit
> support for 2 - [0,0] yet. However, it saves initialization time
> significantly for applications involving large-scale sparse systems.

6 is even faster than 2 anyway, since it does not require to do
anything.

2 may indeed be faster than 3 and 4, if zero-initialization of memory
is faster than initialization to something else.  I don't know if some 
platforms show such behavior.

The only argument I see for 2 is that is it similar to std::complex,
and similar to built-in floating-point types for the explicit
zero-initialization (i.e. "double d = double();" actually initializes
to 0).


> Chenyi
> 
>>>> Sylvain Pion <Sylvain.Pion at sophia.inria.fr> 9/14/2006 5:01 PM >>>
> 
> Ron Avitzur wrote:
>>>>>  1- no default constructor at all
>>>>>  2- [0,0]
>>>>>  3- empty
>>>>>  4- whole
>>>>>  5- uninitialized tag
>>>>>  6- see below (something a la "singular iterator")
>>> As George says, there is indeed no perfect choice.  I can see good
>>> arguments supporting 2, 3, 4, 6 (I see 5 as a debug mode allowed by
> 6).
>> In defense of 1, I'll reiterate my concern from April that folks
> expect
>> declaring  { double foo[kSize]; ...} is free while having any
> default
>> constructor can make { interval<double> foo[kSize]; ... } in an
> inner
>> loop be very costly.
>>
>> I encountered precisely this a few years ago in a context that made
> it
>> very difficult to recognize the inefficiency.
> 
> So, you are arguing for 6, like me.
> 
> 1 means no default constructor, that is, a private one.
> At least, this is how I understood 1.
> 


-- 
Sylvain


More information about the Std-interval mailing list