🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #811

Is this code using casts valid in C++ ?

#811
From: Louis Lamarche
Date: Tue, 05 Feb 1991 00:39
17 lines
1037 bytes
class foo { int a; };
class foob : public foo { int b; };
foo afoo;
foo* afooPtr = &afoo;
foob* afoobPtr = (foob*) afooPtr;
foo& afooRef = afoo;
foob& afoobRef = (foob&) afooRef;  // Ok with g++1.37.0, rejected by g++1.37.2-
main(){}

This code compiles well with CC 2.0 on a Sun and with Zortech 2.1, but fails
with g++1.37.2-. Is it legal ?

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| Louis Lamarche, IREQ |       lamarche@IREQ.Hydro.Qc.CA
| CP 1000, Varennes    |                 or
| QC, Canada, J3X 1S1  |  514-652-8077 (office)  514-324-2919 (home)
Technical Details
Message-ID: <5217@s3.ireq.hydro.qc.ca>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!s3!ireq.hydro.qc.ca!lamarche

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!s3!ireq.hydro.qc.ca!lamarche
From: lamarche@ireq.hydro.qc.ca (Louis Lamarche)
Newsgroups: comp.std.c++
Subject: Is this code using casts valid in C++ ?
Message-ID: <5217@s3.ireq.hydro.qc.ca>
Date: 5 Feb 91 00:39:26 GMT
Sender: root@s3.ireq.hydro.qc.ca
Reply-To: lamarche@ireq.hydro.qc.ca (Louis Lamarche)
Organization: Hydro-Quebec
Lines: 17