🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

g++ 1.34.1 & uninitialized references

#1805
From: Kim Coleman
Date: Tue, 28 Mar 1989 17:47
22 lines
1222 bytes
//  Test that the compiler catches uninitialized references. Given that
//  references are conceptually an object rename, they must be initialized
//  to something (see Stroustrap, p. 56). At best, g++ gives a warning,
//  at worst, it says nothing at all.

    void some_function()
    {
        int&  a_ref;                     // g++ gives a warning
     }

    class erroneous {  
        int&   a_ref;                    // g++ says nothing
    };

Personally, I think both these cases should be an error, but a warning is
better than nothing. Sorry if this has been posted before.

---------------------------
Kim Coleman
Data General Corp., Research Triangle Park, NC
{the world}!mcnc!rti!dg-rtp!coleman
Technical Details
Message-ID: <4609@xyzzy.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!bu-cs!ncsuvx!mcnc!rti!xyzzy!bert!coleman

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!bu-cs!ncsuvx!mcnc!rti!xyzzy!bert!coleman
From: coleman@bert.dg.com (Kim Coleman)
Newsgroups: gnu.g++.bug
Subject: g++ 1.34.1 & uninitialized references
Summary: compiler doesn't always catch them
Keywords: references
Message-ID: <4609@xyzzy.UUCP>
Date: 28 Mar 89 17:47:34 GMT
Sender: usenet@xyzzy.UUCP
Reply-To: coleman@bert.dg.com (Kim Coleman)
Distribution: gnu
Organization: Data General Corporation, Research Triangle Park, NC.
Lines: 21