home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!sun4nl!dutrun!dutiws!holland
- From: holland@dutiws.tudelft.nl (Gerhard den Hollander)
- Newsgroups: comp.lang.c++
- Subject: Simple question, sages advice needed
- Message-ID: <2100@dutiws.tudelft.nl>
- Date: 14 Sep 92 14:45:42 GMT
- Organization: Delft University of Technology
- Lines: 47
-
- Hi,
- I have the following (rather simple and stupid) problem.
-
- I have a Class A, with a member name (of type MyString).
- MyString is just what you'd expect of it,
- and contains a friend function operator<<(...);
-
- I am currently working with yacc/bizon,
- and the following happens.
-
- [Note, yacc passes a A* via it's $$ mechanism]
-
- Yacc-file (stripped a lot)
-
- start : flip flap flop
- {
- cout << *$2 << " Top" << endl;
- }
-
- flap : e f g
- {
- $$ = new A(*$2);
- }
-
- f : e A_POINTER g
- {
- $$ = new A(*$2);
- cout << *$2 << " Bottom" << endl;
- }
-
-
- Well after compiling and running this gives
- Some.value Bottom
- Top
-
- My question is,
- what happened, why doesn't it say Some.value Bottom
- Some.value Top ?
-
- Anyone having ideas ??
-
- (Oh BTW cout << *$2 is the same as cout << $2->name )
-
- Thanks
- please reply via email,
- I'll gather answers and post a summary
-
-