I was curious as to why the following code works when it is a named macro, but complains when it is an unnamed macro. The complaint comes in when I execute the code again and try to delete the previous histograms:
For the unnamed macro I would need to change the starting point from 0 to 1 and adjust the definitions of the arrays appropriately and then it works again.
Humm … the named and unamed macro are handled differently and thus the memory pattern is different (and it may even that the rules for initialization is different). Either way the result should be assumed to unpredictable …
Note: I don’t understand why the code isn’t being displayed properly - see the <4> in the second for loop. I have attached it. array_hist.cpp (682 Bytes)
What you use is what I meant … there seems to be some issue with the forum and copy/pasting of code (I see in your code the following series of characters: [quote]for(int i=0; i<4>FindObject(name[i]); [/quote]
I can reproduce your problem when reloading the unnamed macro. I will investigate.
Unfortunately this is a deficiency of the current CINT bytecode compiler. CINT is currently going through a serious overhaul, including a rewrite of the bytecode compiler. This problem should be solved once all these update are implemented.
In the meantime, you can either use a named macro (which is better anyway ) or disable the bytecode compiler (issue the cint command .O 0 ).