Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!att!dptg!pegasus!hansen From: hansen@pegasus.ATT.COM (Tony L. Hansen) Newsgroups: comp.lang.c++ Subject: Re: Request for C++ coding "guidelines" Summary: can't have multiple definitions of member functions Keywords: C++, inlines, outlined member functions Message-ID: <4481@pegasus.ATT.COM> Date: 22 Feb 90 18:34:45 GMT References: <2754@arran.tcom.stc.co.uk> <25D0B18E.27508@paris.ics.uci.edu> <4446@pegasus.ATT.COM> <25D3D824.15436@paris.ics.uci.edu> Reply-To: hansen@pegasus.ATT.COM (Tony L. Hansen) Organization: AT&T Bell Labs Middletown/Lincroft NJ USA Lines: 31 In article <25D3D824.15436@paris.ics.uci.edu> rfg@ics.uci.edu (Ronald Guilmette) writes: hansen@pegasus.ATT.COM (Tony L. Hansen) writes: << I think that the comments lately have been pointing out problems with << some current implementations of inline functions: << When the inline must be outlined, a static version will be << created as needed in EVERY .o file where it is needed. When the << .o's are combined, you suddenly have N occurrences of the << static function which wastes considerable space. < < I believe that there are two serious problems with your scheme. First, < some programmers out there have yet to "get religion" when it comes to < avoiding the use of the preprocessor to do evil things. Thus, you might < see the following code in a C++ header file someday: < < INLINE void foobar () < { < some_var = SOME_MACRO; < } The cfront 2.0 Reference Manual states (section 3.3) "There must be exactly one definition for each function, object, and class in a program." In an environment such as cfront and g++ provide, this is almost impossible to detect or enforce. In other environments, it may be easy to detect and enforce. Tony Hansen att!pegasus!hansen, attmail!tony hansen@pegasus.att.com