home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!utcsri!torn!mcshub!aruba!ruby!sandys
- From: sandys@aruba.UUCP (Sandy Schindler)
- Subject: inlining friend functions
- Message-ID: <1992Dec15.182858.22555@aruba.uucp>
- Sender: sandys@aruba (Sandy Schindler)
- Date: Tue, 15 Dec 1992 18:28:58 GMT
- Organization: Project Zed
- Keywords: friend inline
- Lines: 35
-
- I would like to inline some friend functions for a class, without placing
- the method definitions inside the class declaration. Such as:
-
- class Foo{
- public:
- friend inline doFoo(const Foo&, const Foo&);
- };
-
- inline doFoo(const Foo& f1, const Foo& f2)
- {
- //something...
- }
-
- This _should_ be legal, according to the 2nd ed., pg 567, "A friend
- function defined in a class declaration is inline and the rewriting rule
- specified for member functions (r9.3.2) is applied..." The HP C++
- compilers (2.x and 3.0) compile this sort of thing without complaint.
-
- BUT, when I try to compile this with Borland's C++ 3.1, I get the error
- message
- Error inl.hh, line xx: Storage class 'inline' is not allowed here
- Borland will not allow the inline keyword to used on a friend function
- inside a class declaration, no matter where the definition happens.
-
- Is this a mere compiler bug on Borland's part, or is this the first
- appearance of a standard restriction? I hope not. With the volume of
- code we're working on, omitting the inline keyword from the headers is not
- an option.
-
-
- --
- ...Mix it all together, and viola! ... hmm, wait, that's not quite it...
- Sandy Schindler |Internet Style: aruba!sandys@uu2.psi.com
- Systems Programming/UI, Club Zed |UUCP: ...!uunet!uu2.psi.com!aruba!sandys
-
-