Dear Philippe, Axel,
many thanks for your comments and suggestions!
On 06/27/2011 06:39 PM, Philippe Canal wrote:
> For better or worse, this is not (and can not be) valid C++ code. In
> order to make the call to the Fill function (in particular because
> it is a virtual function), C++ requires dereference the pointer
> _before_ calling the function (because without this dereferencing it
> has _no_ way of knowing which function to call).
Thank you for pointing that out. I have used code like
MyObject::Bla() {
if (!this) return;
...
}
before, but I guess it only worked back then, because the Bla() wasn't virtual.
I've settled now for a variant using macros:
#define DRAW(H, ...) do { if (H) H->Draw(__VA_ARGS__); } while (0) #define FILL(H, ...) do { if (H) H->Fill(__VA_ARGS__); } while (0)
Kind regards,
Thiemo
-- +-----------------------------------+--------------------------+ | Dipl.-Phys. Thiemo Nagel | | | Technische Universitaet Muenchen | Room PH1 3276 | | Physik-Department E18 | | | James-Franck-Strasse | Phone +49 89 289-12379 | | D-85747 Garching | Fax +49 89 289-12570 | +-----------------------------------+--------------------------+Received on Fri Jul 01 2011 - 14:34:02 CEST
This archive was generated by hypermail 2.2.0 : Fri Jul 01 2011 - 17:50:01 CEST