[GiNaC-list] memory allocation, matrices
Richard B. Kreckel
kreckel at ginac.de
Mon Sep 11 23:30:35 CEST 2006
Hi!
Marko Riedel wrote:
>Thanks! This thread is exactly what I was looking for. Can you briefly
>explain the meaning of reinterpret_cast<GiNaC::ex*>? Wouldn't
><GiNaC::ex*> be sufficient?
>
>
The way you write it is not valid. I suppose you mean C-style cast
(GiNaC::ex*) instead. Yes, you can as well write it using C-style cast.
But you may wish to read a little bit in any textbook about C++ about
arguments against C-style cast. The point is that reinterpret_cast<T*>
is telling the reader a little bit more than (T*).
>Also, in GiNaC, if I have an expression
>that is actually a symbol, say, how do I determine at compile time
>what destructor to call, ~ex or ~symbol?
>
>
I am not sure if it is such a good idea to do that with objects of class
symbol. Why not always wrap the symbols in an ex in your code? The ex
are supposed to be helpful when interfacing to environments where one
has to give up on C++ types.
Anyway: If the object was constructed as a symbol statically, then you
have to destroy it as a symbol. If the ex at compile time turns out to
be a symbol, then, well, it's still just an ex holding a symbol and you
have to destroy it as an ex.
>I will need to invoke the destructor explicitly in the deallocation
>code of my Objective C object.
>
>
Ugh!
-richy.
--
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>
More information about the GiNaC-list
mailing list