Passing additional arguments to scripts on command line in v6.32


ROOT Version: 6.32.02
Platform: linuxx8664gcc
Compiler: g++ (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3)


In previous version (e.g. v6.22) I am able to pass extra arguments to scripts like this:

root myscript.C -d 150

where a warning about “macro 150 not found” will be shown but the program runs fine. In the script I can check the arguments with gApplication->Argv() and process accordingly.

Now in v6.32, it will complain that

root: unrecognized option '-d'
root: unrecognized option '150'

and quits.

So is this change documented somewhere? Is it possible to continue working this way [working with gApplication->Argv() in scripts]? Thanks!

As workaround, you could do instead:

void myscript(int d)
{
}

and then:

root 'myscript.C(150)'
or
root myscript.C+(150)

Yes! That is possible if I have only one argument. Unfortunately I may have actually multiple arguments to specify, sth like -a 1 -b 2 -c 3 -d 150, depends on the situation. That’s why I did not use function arguments at the beginning.

Another workaround for the case of variable number of arguments:

void myscript(TString argv)
{
}

and

root myscript.C+(\"-d 150 -a 1\")

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