Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!nstn.ns.ca!news.cs.indiana.edu!samsung!uunet!mcsun!ukc!edcastle!eanv20 From: eanv20@castle.ed.ac.uk (John Woods) Newsgroups: comp.lang.c++ Subject: Please help me... Keywords: Tracer, Help, Destruct Message-ID: <7748@castle.ed.ac.uk> Date: 10 Jan 91 11:10:38 GMT Distribution: comp Organization: Edinburgh University Computer Services Lines: 53 I would be very grateful for any help on the following. "ARMtrace.h" contains the Tracer class from ARM 3.5 (p22). Objects of this class are created with a string argument, which is echoed to the standard error in the form "... entered". On destruction of the object (when it goes out of scope) the string is echoed once more, with the message "exit from ...", providing a neat way to track the program. So, how does the following output: main entered in main foo entered in foo, bar = 1 exit from foo still in foo still in main exit from main result from: #include #include "ARMtrace.h" void foo( int bar ) { Tracer("foo"); cerr << "\tin foo, bar = " << bar << "\n"; if( bar ) ; cerr << "\tstill in foo\n"; } main() { Tracer("main"); cerr << "\tin main\n"; foo(1); cerr << "\tstill in main\n"; return 0; } The interesting thing is that replacing if( bar ) with if( 1 ) or if( 0 ) causes the output to be tthat expected. Sorry for the length and probable naivety of this posting, but I am at my wit's end. THadvanceNX... ...John Woods -- /******* cut here ******* John Woods ******* cut here ******** * Philosophy: Forsan et haec olim meminisse iuvabit (Virgil) * * Disclaimer: Every statement in this file is possibly !true * ******** cut here ******* John Woods ******* cut here *******/