print "2";
It prints "21". This is because a) the return value of a successful
print is "1", b) the main routine is returning the value of the last
statement (note this is correct for Perl, but isn't correct for all
languages), and c) HLLCompiler is printing out the return value of the
eval'd code here:
376 save_output_1:
377 print ofh, result
378 close ofh
Commenting out line 377 gives the correct behavior of just printing "2".
My question is, why is HLL compiler printing out the return value of the
main routine?
Allison
What revision number are you working with? I think this was fixed in
a later revision of HLLCompiler.
(It outputs the return value from the compilation phase when
--target=pir is specified. The previous version was a bit
overeager about outputting the result.)
Pm
Aye, this was yesterday. Working now.
Allison
print "2";
It prints "21". This is because a) the return value of a successful
print is "1", b) the main routine is returning the value of the last
statement (note this is correct for Perl, but isn't correct for all
languages), and c) HLLCompiler is printing out the return value of the
eval'd code here:
376 save_output_1:
377 print ofh, result
378 close ofh
Commenting out line 377 gives the correct behavior of just printing "2".
My question is, why is HLL compiler printing out the return value of the
main routine?
Allison