strange situation

From: Yuri A. Belikov (belikov@sunhe.jinr.ru)
Date: Fri Aug 01 1997 - 11:40:09 MEST


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



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:20 MET