goss@ese.essex.ac.uk (Gossain Sanjiv) (06/23/89)
Here's a funny little one...
....coutesy of Bruce Anderson, Dept. of ESE, Essex University
Colchester, Essex, UK. < bruce%ese.sx.ac.uk@nsfnet-relay>
/* funny in reference argument checking and execution
This code does not compile with AT&T 1.2; with g++ 1.35
it gives
99--99--99.1
0--0--8.48798e-315
This can't be right!
My own belief is that it should fail to compile; otherwise
how about correct coercion both ways?
*/
#include <stream.h>
void zap(int& x) { x = 0; }
main()
{ int i = 99; double d = 99.0; double d1 = 99.1;
cout << i << "--" << d << "--" << d1 << "\n";
zap(i);
zap(d);
zap(d1);
cout << i << "--" << d << "--" << d1 << "\n";
}
______________________________________________
Sanjiv Gossain
Dept. of ESE
Essex University
Colchester CO4 3SQ
ENGLAND
<goss%ese.sx.ac.uk@nsfnet-relay>
<goss%ese.essex.ac.uk@cunyvm.cuny.edu>