Return from an unnamed macro in ROOT 6 broken

@Axel This works fine in ROOT 5.34.

This is a new problem in ROOT 6 (6.14/00, 6.12/06, …, Ubuntu 14.04 / x86_64 / gcc 4.8.4).

I get:

root [0] .x test.cxx
We got AFTER Double_t X?
We got AFTER Double_t Y?
root [1] .q

from the unnamed macro “test.cxx”:

{
  return; // try to comment out this line and rerun this macro
  std::cout << "We start ..." << std::endl;
  return;
  std::cout << "We got BEFORE Double_t X?" << std::endl;
  Double_t X; // try to comment out this line and rerun this macro
  std::cout << "We got AFTER Double_t X?" << std::endl;
  return;
  std::cout << "We got BEFORE Double_t X?" << std::endl;
  Double_t Y; // try to comment out this line and rerun this macro
  std::cout << "We got AFTER Double_t Y?" << std::endl;
}

A “brutal fix” for the moment, which seems to work, is to define ALL VARIABLES (appearing in an “unnamed macro”) right in the beginning of this macro (i.e. before any “return;” statement).

This is a known issue tracked as
https://sft.its.cern.ch/jira/browse/ROOT-4780 The workaround is easy:
use a named macro, please!

Could you, please, increase the “Priority” for this jira report.

Named macros are not a replacement for the unnamed ones.
One needs all variable which are created in unnamed macros to be still accessible from the ROOT prompt (global namespace).
And then the user and/or another unnamed macros are supposed to be able to modify these variables.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.