CompuServe Thread

#ZTC v2 and old cols

4 messages in this thread
#23678From: EricFJan 18, 1990 11:11 PM
Al – I have been trying to pick up C++, and have found your column helpful. Recently I upgraded to the Zortech C++ version 2 compiler, and found that some of your programs published in the fall will no longer compile. (No problem with version 1.07.) I've been able to make most of the changes needed, but am running into run time problems (pointers) with demopop in the Oct. '89 issue. The code in menus.c) for the PopDownMenu class overloaded operator << and for the get_selection method (also in the PopDownMenu class) get compile errors when making assignments to several of the self-referencing pointers this. (Sorry if I got the jargon wrong. It's not easy going.) Have you upgraded compilers? I'd like to see what the fix is. Thanks – EF -n menus.cxe
#23680From: Al StevensJan 19, 1990 1:12 AM
EricF, Sorry, I do not have the new Zortech. Al Stevens
#23682From: Mike Floyd/DDJJan 19, 1990 10:36 AM
Hmmm… I asked the people at Zortech to send you a copy. Looks like it fell in the cracks. I'll see what I can do. — MF
#23686From: John M. DlugoszJan 19, 1990 4:00 PM
You can't assign to `this'. The type of `this' in a member function of a class X is (X *const this), so you can see that an assignment will in fact cause an error, "attempt to assign to a const object". see the reference manual paragraph 9.3.1. I suggest you change code like: while (this) { //do stuff this= next; } into: X* tthis= this; while (tthis)…. that is, define a new, non-const variable at the top of the function and assign it the same pointer, and proceed to use that one. Problem is your references to members will then need to be qualified tthis->next for example. –John