Shift operator, array subscripts

Hi.

With ROOT’s trunk on linux and windows I have a strange behavior.
Several code samples to reproduce the problem, they are intentionally
simplified and useless:

void r()
{
   int arr[3] = {};
   int i = 0;
   std::cin>>arr[i * 3]>>arr[i * 3 + 1]>>arr[i * 3 + 2];
}

Expressions inside subscript are required to get this error message:

[quote]root [0] .x r.C
Error: G__getvariable: expression r.C:5:
Error: Illegal pointer operation (tovalue) r.C:5:
(const int)0
*** Interpreter error recovered ***
[/quote]
If I put parenthesis around subscript sub-expression, there is no error.

Another shift operator sample:

void r() { int arr[1] = {}; int num = 0; 8>>arr[num * num]; }

Expression inside brackets is required to get this message:

[quote]root [0] .x r.C
Error: G__getvariable: expression r.C:5:
Error: Symbol nu is not defined in current scope r.C:5:
(const int)1
*** Interpreter error recovered ***[/quote]

Hi,

we know that the CINT parser has several limitations - operators are one of them. We are looking into using a completely new C++ parser with a completely new C++ interpreter (nicknamed “cling”) to remove most of CINT’s limitations. But I am afraid that the parentheses work-around you have found is all I can offer for now.

Cheers, Axel.

Hi.

[quote=“Axel”]Hi,
We are looking into using a completely new C++ parser with a completely new C++ interpreter (nicknamed “cling”) to remove most of CINT’s limitations.
[/quote]

Wow! Good news!

Hi,

yeah, we’re also pretty excited - but we first need to show that it will actually work. So continue breathing, it’ll take years until it’s competitive with the current CINT.

Cheers, Axel.