octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rc/ov.h:166: warning: 'octave_value::rep' should be initialized in t


From: CdeMills
Subject: Re: rc/ov.h:166: warning: 'octave_value::rep' should be initialized in the member initialization list
Date: Mon, 17 Jan 2011 12:44:27 -0800 (PST)


Jaroslav Hajek-2 wrote:
> 
> 
> 
> That was an optimization. If you had the default ctor instead do new
> octave_base_value(), it would be way slower and consume more memory. I
> vaguely recall this cut down the time to construct a big cell array by
> factor of 5 or so.
> Many other refcounted classes in Octave use this optimization as well.
> 
> Technically, yes, this can occur in case of overflow. And it's not
> just this place, there are many others. It should be technically
> impossible to trigger this from the interpreter, however. dim_vector
> won't let you construct an array whose size overflows octave_idx_type
> (see dim_vector::dim_max and dim_vector::safe_numel). Creating several
> large cell arrays from within the interpreter doesn't mind, because
> Cell::resize_fill_value will create a separate fill value for each of
> them. There should be a big fat warning "DON'T ever change this to a
> static value" in that method :D
> So the only way to shoot yourself in the foot is internally creating
> several large uninitialized Array<octave_value> instances at once.
> Hopefully we don't do that.
> 
> But in general, I agree that this is kind of fragile and deserves more
> checking. But please also understand that these constructors (and
> associated assignment ops, copy ctors and dtors) are speed-critical
> and none of that "safety first, performance second" crap should be
> applied here, any non-cosmetic changes in this stuff should absolutely
> come with measurements of performance impact and should be discussed
> first.
> 
> 
Hello,
thank you for your detailled reply. With regard to the first topic, I looked
and didn't find places where this constructor with no input argument was
used: could you give some hint ?
For the second topic: I agree with you. Out of some error message, I spotted
some place and find code leading there, but I didn't look at code using this
part. If the error will be intercepted in the upper layers, then no problem:
performance first.

Regards

Pascal
-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/rc-ov-h-166-warning-octave-value-rep-should-be-initialized-in-the-member-initialization-list-tp3218135p3221258.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]