Path: utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!ORION.CF.UCI.EDU!schmidt%blanche.ics.uci.edu From: schmidt%blanche.ics.uci.edu@ORION.CF.UCI.EDU ("Douglas C. Schmidt") Newsgroups: gnu.g++.bug Subject: g++ too permissive with const * parameters Message-ID: <8810310955.aa02581@PARIS.ICS.UCI.EDU> Date: 31 Oct 88 17:55:09 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 36 Hi, The following program demonstrates an attempt to circumvent the const specifier: ---------------------------------------- void foo ( const int *f ) { int *foo = f; *foo = 100; // defeat const! } main () { int foobar; int *bar = &foobar; foo ( bar ); } ---------------------------------------- g++ doesn't complain about this, whereas CC retorts: ---------------------------------------- CC test.C: "test.C", line 6: error: bad initializer type const int * for foo ( int * expected) 1 error ---------------------------------------- This seems like a reasonable approach, no? Doug ------------------------------ schmidt@bonnie.ics.uci.edu (ARPA) | Per me si va nella cita dolente. | Per me si va nell' etterno dolore. | Per me si va tra la perduta gente. | Lasciate ogni speranza voi ch' entrate.