Path: utzoo!attcan!uunet!cs.utexas.edu!usc!wuarchive!julius.cs.uiuc.edu!psuvax1!husc6!ngo@ymer.harvard.EDU From: ngo@ymer.harvard.EDU (Thomas Ngo) Newsgroups: comp.lang.c++ Subject: Re: [SUMMARY] Three ways to declare a function "const" in C++ 2.0 Message-ID: <4454@husc6.harvard.edu> Date: 17 Oct 90 17:09:30 GMT References: Sender: news@husc6.harvard.edu Reply-To: ngo@tammy.harvard.EDU (Thomas Ngo) Distribution: comp Organization: Chemistry Department, Harvard University Lines: 29 In article , scp@acl.lanl.gov (Stephen C. Pope) replied to my original posting: scp> ngo@tammy.harvard.edu (Tom Ngo) said: scp> ngo> scp> ngo> In g++, you can declare a function "const", e.g. scp> ngo> const double sin( double x ) scp> ngo> [indicating that successive calls to this sin() need not be scp> ngo> repeated if x has not changed in the interim...] scp> ngo> scp> ngo> [In AT&T C++ 2.0, the "const" means the function returns a scp> ngo> "const double", which is meaningless in this particular context...] scp> ngo> scp> ngo> Tony Hansen remarked: scp> ngo> It's a relatively new extension of g++. scp> scp> Only thing is, g++ doesn't always do anything with it; this is especially scp> true of virtual methods. Word is that this g++ extension is going away...! Interesting. In support of making this extension go away, someone else pointed out to me that in a case like const double* foo() the const would NOT be meaningless in AT&T C++ 2.0. Tom Ngo ngo@harvard.harvard.edu 617/495-1768 lab number, leave message