Re: [Libreoffice] semantics of ScBaseCell* lclCloneCell

2011-10-27 Thread Stephan Bergmann

On 10/27/2011 07:10 AM, Kevin Hunter wrote:

I'm nosing around ScBaseCell in sc/source/core/data/cell.cxx, and I'm
curious about the semantics of the function lclCloneCell. Specifically,
when would that function ever return a NULL pointer? Does Calc not know
about all its cell types? Perhaps extensions are able to add their own
cell types and still use this function? (Then why would they use this
function?!)


Not an sc expert, but from looking at the code it looks to me like the 
default case shall never be reached, but is there to (a) silence 
compiler warnings and (b) fire an OSL_FAIL in case there is a 
programming error that causes the case to be reached nonetheless (I 
usually put a this cannot happen into such OSL_FAILs, in good old 
Knuth tradition).  And since the function still needs to syntactically 
return something, even in this unreachable case, it returns the 
canonic null value.


Stephan
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] semantics of ScBaseCell* lclCloneCell

2011-10-27 Thread Eike Rathke
Hi Stephan,

On Thursday, 2011-10-27 08:49:19 +0200, Stephan Bergmann wrote:

 On 10/27/2011 07:10 AM, Kevin Hunter wrote:
 I'm nosing around ScBaseCell in sc/source/core/data/cell.cxx, and I'm
 curious about the semantics of the function lclCloneCell.
 
 Not an sc expert

Perfect analysis nonetheless ;)

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GnuPG key 0x293C05FD : 997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD


pgpOtrradalW0.pgp
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] semantics of ScBaseCell* lclCloneCell

2011-10-27 Thread Kevin Hunter

At 2:49am -0400 Thu, 27 Oct 2011, Stephan Bergmann wrote:

On 10/27/2011 07:10 AM, Kevin Hunter wrote:

I'm nosing around ScBaseCell in sc/source/core/data/cell.cxx, and I'm
curious about the semantics of the function lclCloneCell. Specifically,
when would that function ever return a NULL pointer? Does Calc not know
about all its cell types? Perhaps extensions are able to add their own
cell types and still use this function? (Then why would they use this
function?!)


Not an sc expert, but from looking at the code it looks to me like the
default case shall never be reached, but is there to (a) silence
compiler warnings and (b) fire an OSL_FAIL in case there is a
programming error that causes the case to be reached nonetheless (I
usually put a this cannot happen into such OSL_FAILs, in good old
Knuth tradition). And since the function still needs to syntactically
return something, even in this unreachable case, it returns the
canonic null value.


Huh.  Then why use a switch?  Why not use an if-else set of clauses?  I 
recognize that this function may be called a lot, but does an if vs 
switch statement mean /that/ much in terms of performance?


In any event, thanks for the response.

Kevin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] semantics of ScBaseCell* lclCloneCell

2011-10-26 Thread Kevin Hunter

Hullo Calc Devs,

I'm nosing around ScBaseCell in sc/source/core/data/cell.cxx, and I'm 
curious about the semantics of the function lclCloneCell.  Specifically, 
when would that function ever return a NULL pointer?  Does Calc not know 
about all its cell types?  Perhaps extensions are able to add their own 
cell types and still use this function?  (Then why would they use this 
function?!)


Thanks,

Kevin
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice