1 Jul 2011 14:33
Re: [ROOT] easy histogram disabling
Thiemo Nagel <thiemo.nagel <at> tum.de>
2011-07-01 12:33:55 GMT
2011-07-01 12:33:55 GMT
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
--
--
(Continue reading)
RSS Feed