Why isn't const used for void* argument in Branch()?

Hi!

I’ve a question concerning TTree::Branch() http://root.cern.ch/root/html/TTree.html#TTree:Branch@3.

Why isn’t the argument “void* address” const? Is the address pointer used to modify the pointed object under certain circumstances? I Would have expected it to be

Branch(const char* name, const void* address, const char* leaflist, Int_t bufsize = 32000)

Thanks in advance,
Bjorn

Hmm. Let’s ask authors of posix, C/C++ standard library, X11, Xext, Xpm, OpenGL, Win API, Core Foundation, any API/Framework/Lib you can imagine WHY they do not use ‘const’ qualifier where they expected to?
Legacy? 20-30-year old code? Is it really a problem blocking you?

P.S. back to the point - do not worry, TTree::Branch is not modifying your data.

Hi,

I can do a const_cast, so it’s not blocking me. However before doing that I wanted to be sure that it’s not modifying. So thanks for the confirmation.

Cheers,
Bjorn

[quote=“Bjorn”]Hi,

I can do a const_cast, so it’s not blocking me. However before doing that I wanted to be sure that it’s not modifying. So thanks for the confirmation.

Cheers,
Bjorn[/quote]

You are writing a tree, right?
Do you fill it with a constant value?

The value isn’t constant. However the class which is writing the tree accesses the value by a const reference.