Hi Regina,

On Monday, 2010-08-16 22:40:49 +0200, Regina Henschel wrote:

> > Thanks for catching. I'll see if I can easily introduce the mentioned
> > CloneIfConst() approach or have to simply fix this with an
> > unconditional Clone().
> 
> Isn't the total length of a formula restricted to 255 characters?

No, the length of one symbol/token was limited to 255 characters,
nowadays is 1024. A token is an operator, a function name, a literal
string, ... Each element of a constant matrix is a token. The maximum
total length of a formula is 512 tokens.

> If so, a constant matrix cannot be huge and cloning is harmless.

An unconditional clone would also clone any range reference that was
converted to a matrix. This is the case we'd like to avoid.

> Does your suggestion mean, that changing the values in the parameter
> matrices in the implementation of the function would then be always
> possible? Or will there be a property of pMatY which I have to test
> inside the implementation for to decide, whether I can change it or have
> to use a clone?

What I have in mind would be a method
ScMatrixRef ScMatrix::CloneIfConst()
that could be called as

    ScMatrixRef pNew = pMatY->CloneIfConst();
    ... modify pNew ...
    pMatY = pNew;

If pMatY was mutable, the call wouldn't clone the matrix but just add
a new reference and modifying pNew would actually modify pMatY. The
ScMatrix ctor would always flag a matrix as immutable and only
ScInterpreter::GetNewMat() would set that to mutable, and the final
result matrix would be set to immutable again in case it is used as
input for another expression. However, the case of array context needs
to be evaluated, as multiple calls to a function that expects mixed
scalar and matrix parameters of course should not modify the matrix
multiple times. If there is no easy solution to that I'll refrain from
changing things for OOo3.3 and just clone the matrix.

  Eike

-- 
 OOo Calc core developer. Number formatter stricken i18n transpositionizer.
 Signature key 0x87F8D412 : 2F58 5236 DB02 F335 8304  7D6C 65C9 F9B5 87F8 D412
 OpenOffice.org Engineering at Oracle: http://blogs.sun.com/GullFOSS
 --
 Please don't send mail to the old e...@sun.com account that I used for mailing
 lists, it phased out. Use eike.rat...@oracle.com instead. Thanks.

Attachment: pgptbayagk4j4.pgp
Description: PGP signature

Reply via email to