daniel@saturn.ucsc.edu (Daniel Edelson) (02/11/89)
There appears to be a bug in cfront 1.1 which causes this program to print garbage in the third output. We've found three ways of sidestepping the bug. 1) replace all instances of float with double 2) use a local variable in foo(); pass the address of the local 3) use the oregon C++ compiler =-=-=-=-=-=-=-=-=-= #include <stream.h> void foo(float l); void bar (float *lp); main() { float l=1.5; cout << "main: l == " << l << "\n"; foo(l); } void foo(float l) { cout << "foo: l == " << l << "\n"; bar(&l); } void bar (float *lp) { cout << "bar: *lp == " << *lp << "\n"; } =-=-=-=-=-=-=-=-=-= Rewriting the function foo() like this solves the problem. -=-=-=-=-=-=-=-=-=- foo(float l) { float m=l; cout << "foo: m == " << m << "\n"; bar(&m); } ************************************************************** Daniel Edelson daniel@saturn.ucsc.edu