🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #76

a funny little one

#76
From: Gossain Sanjiv
Date: Fri, 23 Jun 1989 11:45
40 lines
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>
Technical Details
Message-ID: <1175@servax0.essex.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcvax!ukc!servax0!ese.essex.ac.uk!goss

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcvax!ukc!servax0!ese.essex.ac.uk!goss
From: goss@ese.essex.ac.uk (Gossain Sanjiv)
Newsgroups: gnu.g++.bug
Subject: a funny little one
Message-ID: <1175@servax0.essex.ac.uk>
Date: 23 Jun 89 11:45:24 GMT
Sender: news@servax0.essex.ac.uk
Reply-To: goss@ese.essex.ac.uk (Gossain Sanjiv)
Distribution: gnu
Organization: University of Essex, Colchester, UK
Lines: 40