strange situation

Yuri A. Belikov (belikov@sunhe.jinr.ru)
Fri, 01 Aug 1997 13:40:09 +0400


Dear ROOTers !

I have run into the strange situation. The skeleton macro below
did't work rightly ( the diagnostics was : "Changing const n ..." ).

#include <iostream.h>

class X {
public:
int f(int j) const {return j;}
};

void main() {
X a;
for (int i=0; i<3; i++) {
int n=a.f(i);
switch (n) {
case 0: cout<<n<<endl; break;
case 1: cout<<n<<endl; break;
case 2: cout<<n<<endl; break;
}
}
}

Meanwhile, the next modification worked fine ( member function f is not
constant now ).

#include <iostream.h>

class X {
public:
int f(int j) /*const*/ {return j;}
};

void main() {
X a;
for (int i=0; i<3; i++) {
int n=a.f(i);
switch (n) {
case 0: cout<<n<<endl; break;
case 1: cout<<n<<endl; break;
case 2: cout<<n<<endl; break;
}
}
}

Help me please !
My system configuration is
Linux 2.0.27
ROOT 1.02/00
CINT 5.13.17

Yuri Belikov