head     1.3;
branch   ;
access   ;
symbols  ;
locks    ; strict;
comment  @// @;


1.3
date     92.06.28.04.46.22;  author fischer;  state Exp;
branches ;
next     1.2;

1.2
date     92.06.27.04.58.26;  author fischer;  state Exp;
branches ;
next     1.1;

1.1
date     92.06.27.03.07.17;  author fischer;  state Exp;
branches ;
next     ;


desc
@Some basic indexing/assignment tests for use with the symbolic
debugger.
@


1.3
log
@cleaned up bogus comments, added an example error.
@
text
@// Emacs: -*- C++ -*-

static char rcsid[] = "$Id: test5.cc,v 1.2 92/06/27 04:58:26 fischer Exp Locker: fischer $";

//
// $Log:	test5.cc,v $
// Revision 1.2  92/06/27  04:58:26  fischer
// Minor frobs, mostly used for debugger traces to get an idea of
// what was going wrong (fixed, so comments are wrong).
// 
// Revision 1.1  92/06/27  03:07:17  fischer
// Initial revision
// 
// 

#include <Point.h>

int main(int argc, char**argv)
{
    Point	p(10,20,30,40), q(1), r;
    Coord       c(11.1), d(2);
    
    IA::exit_on_throw = 0;

    q[0] = q[0];
    
    cout << "d = q[0], where d is " << d << " (" << d.type() << "), q is " << q << " ("
	 << q.type() << ")\n";	
    d = q[0];
    cout << "d is now " << d << " (" << d.type() << ")\n";
    
    cout << "p[0] = p[0] + 100, where p is " << p << " (" << p.type() << ")\n";    
    p[0] = p[0] + 100;
    cout << "p is now " << p << " (" << p.type() << ")\n";

    
    cout << "p[1] = c, where p is " << p << " (" << p.type() << ") and c is "
	 << c << " (" << c.type() << ")\n";
    p[1] = c;
    cout << "p is now " << p << " (" << p.type() << ")\n";
    
//    cout << "p[2] += 2 , where p is " << p << " (" << p.type() << ")\n";
//    p[2] += 2;
//    cout << "p is now " << p << " (" << p.type() << ")\n";

}


@


1.2
log
@Minor frobs, mostly used for debugger traces to get an idea of
what was going wrong (fixed, so comments are wrong).
@
text
@d3 1
a3 1
static char rcsid[] = "$Id: test5.cc,v 1.1 92/06/27 03:07:17 fischer Exp Locker: fischer $";
d7 4
d21 1
a21 1
    Coord       c(11), d(2);
d28 1
a28 2
	 << q.type() << ")\n";
	
a29 1

d32 1
a32 11
    //    
    // The above works as follows:
    // 1  SubPoint:: operator []  via constuctor SubPoint(Coord*) creates a victim slot,
    //    a pointer to the coordinate q[0].
    // 2  SubPoint::Coord() constructor called, where victim still points to q[0]
    // 3     return value is built via Coord::operator float()!
    // 4     Point::Coord(float) constructor builds a new float on above
    // 5  d is assigned the float 1!

    cout << "p[0] = p[0] + 100, where p is " << p << " (" << p.type() << ")\n";
    
a33 1

d36 3
a38 17
    // The above works as follows:
    // Right Hand Side:
    // 1  p[0] extracts, via the SubPoint operator[], a pointer to p.coordinate[0] calling...
    // 2       The SubPoint Coord(Coord*) constructor and ``interns'' same pointer as component
    //         victim: p[0] is this *(SubPoint.victim)
    // 3  The SubPoint Coord() operator called on this *(SubPoint.victim), calling
    // 4       Coord::float() operator to build from this SubPoint a float!!!!!!
    // 5  the int 100 is turned into a Coord via Coord::Coord(int) constructor
    // 6  Coord operator+ picks float/float addition, thus calling Coord::float() on the INTEGER
    //    Coord 100 (returning a float, calling the Coord(float) constructor, etc. 
    // Left Hand Side:
    // 1  p.SubPoint[] gets a pointer to p.coordinate[0], constructing a SubPoint with victim
    //    component via the SubPoint(Coord*) constructor.
    // 2. SubPoint::Coord() called on this, returning the Coord (was it?)
    // 3. SubPoint &operator=(Coord c) is called, with c= p[0]+100 (gdb screws up printing this).
    // 4.    attempts to promote this, it fails, assuming we have a float Coord (which it did)

d40 5
a44 1
    p[2] = 2;
@


1.1
log
@Initial revision
@
text
@d3 1
a3 1
static char rcsid[] = "$Id$"
d6 3
a8 1
// $Log$
d10 1
d16 1
a16 1
    Point	p(10,20,30,40), q(1);
d21 2
a22 1

a63 2
    p[3] = 3.0;
    p[4] = 4.0 + p[4];
@
