Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rutgers!clyde!watmath!orchid!gamiddleton From: gamiddleton@orchid.waterloo.edu (Guy Middleton) Newsgroups: comp.lang.c++ Subject: another probably dumb question Message-ID: <10148@orchid.waterloo.edu> Date: Sat, 8-Aug-87 01:16:09 EDT Article-I.D.: orchid.10148 Posted: Sat Aug 8 01:16:09 1987 Date-Received: Sun, 9-Aug-87 10:51:12 EDT Distribution: comp Organization: Waterloo Liberation Army Lines: 26 I seem to have a problem with destructors. In this code here: #include "string_class.h" main( int argc, char *argv[] ) { string x; if ((x = getstr()) != (string) NULL) print_string( x ); } ... the constructor for the string class is called one more time than the destructor. If I change it to read: x = getstr(); if (x != (string) NULL) print_string( x ); then they get called the same number of times. I realise I probably haven't provided enough information here, but I didn't want to post a huge message. Does anybody have any idea what might be going on? __ -Guy Middleton, University of Waterloo Institute for Computer Research gamiddleton@math.waterloo.edu, watmath!gamiddleton, gamiddleton@water.bitnet