[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::decladebug

Title:Digital Ladebug debugger
Moderator:TLE::LUCIA
Created:Fri Feb 28 1992
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:969
Total number of notes:3959

794.0. "C1::zero is not the same as zero or C2::zero" by ADA9X::BRETT () Fri Jan 24 1997 15:43

Consider




class C1{
    public:
        enum {zero, one, two, three} numbers;
} c1;

class C2{
    public:
        enum {three, two, one, zero} reverse_numbers;
} c2;


int main()
{
    return c1.numbers + C1::zero + C1::one + C1::two + C1::three;
}



When you debug this, ladebug doesn't print out the scope of the enumeral

(ladebug) run
[1] stopped at [int main(void):14 0x120002138]
     14     return c1.numbers + C1::zero + C1::one + C1::two + C1::three;
(ladebug) p c1.numbers
zero


/Bevin
T.RTitleUserPersonal
Name
DateLines
794.1TLE::LUCIAhttp://asaab.zko.dec.com/~lucia/biography.htmlMon Jan 27 1997 12:3710
What other class members ought to have the class scope?  We don't print it for
any 'print' command that I know of.  stop in and the associated reporting
mechanism print the class name::member...  

What happens with (assuming they work right) assignment?  Do you say a
c1.numbers=zero or a c1.numbers=c1::zero?  And if C2 is derived from C1 then it
gets even more confusing.

cout << c1.numbers says 0

794.2ADA9X::BRETTTue Jan 28 1997 19:397
*ALL* class members ought to have class scope.

For assignment, you must say (assuming you are outside the class)

	C::E e = C::e1;

/Bevin
794.3TLE::LUCIAhttp://asaab.zko.dec.com/~lucia/biography.htmlWed Jan 29 1997 11:2532
> *ALL* class members ought to have class scope.

What do you really mean?

class foo {
public:
  foo();
  void print();
private:
  int x;
};

whatis foo

class foo {
  void foo::foo(void);
  void foo::print(void);
  int foo::x;
}

??

what if we've entered 'class  foo' to set the current scope?

I think some enumeration is important to get this right.  Otherwise, it will be
more noise than help.  I ran into this problem when I made ladebug do
language-dependent printing of types (mostly Fortran/Cobol/Ada changes, but the
general mechanism was implemented and then C/C++ were made to use it) and the
combinatorics get large very very quickly.

Tim
 
794.4ADA9X::BRETTWed Jan 29 1997 11:3820
I see your point.

The problem is you have to print out the qualified name being sensitive to
where it is.  

For example

class C1 {
    typedef int T1;
    T1 x;
};

class C2 {
    C1::T1 x;
};

I agree that ladebug should strip off the leading part of the qualified
name that corresponds to the scope that is being shown.

/Bevin
794.5TLE::BRETTThu May 01 1997 09:4614
(ladebug) whereis zero
"tmp.cxx"`C2._DECCXX_generated_name_16ee17bf.zero
"tmp.cxx"`C1.zero
"tmp.cxx"`C2.zero
"tmp.cxx"`C1._DECCXX_generated_name_1abbf85e.zero


We should not be printing out the _DECCXX_generated_name_*
cases (although this may be a compiler/GEM issue, since doesn't happen in
.c cases)

We should be using :: not . as the separator

/Bevin
794.6Fixed!TLE::SUBIRTue May 06 1997 07:293
    This is fixed in -36.
    
    Subir
794.7TLE::BRETTTue May 06 1997 08:463
The base note is fixed, but the issues in .-2 aren't

/Bevin