Thread View: gnu.g++.bug
1 messages
1 total messages
Started by Gossain Sanjiv
Fri, 23 Jun 1989 11:45
a funny little one
Author: Gossain Sanjiv
Date: Fri, 23 Jun 1989 11:45
Date: Fri, 23 Jun 1989 11:45
40 lines
1455 bytes
1455 bytes
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>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads