Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!decwrl!borland.com!pete From: pete@borland.com (Pete Becker) Newsgroups: comp.lang.c++ Subject: Re: Public vs Private header files in C++ Message-ID: <1991Jun10.165009.9687@borland.com> Date: 10 Jun 91 16:50:09 GMT References: <25231@well.sf.ca.us> <1667@msa3b.UUCP> Organization: Borland International Lines: 21 In article <1667@msa3b.UUCP> kevin@msa3b.UUCP (Kevin P. Kleinfelter) writes: >warsaw@nlm.nih.gov (Barry A. Warsaw) writes: >>// foo.h >>class foo >>{ >> ... >>inline int foo::number( void ) >>{ >> return( priv_number ); >>}; > >Oddly enough, this can produce multiple definitions of > int foo::number (void); >with BC++, if you have "out of line inline functions" enabled. >It will literally create a copy of the function in each module compiled. While that statement is true, it's not complete. When you select out of line inline functions (which is the default when you generate debugging information), each .OBJ gets a copy of each of the inline functions that it uses. But the linker only pulls in one of those definitions, so there's only one copy in the resulting executable file.