Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #14306

Re: how to inline member function is a separate file

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: how to inline member function is a separate file
Date 2012-02-20 18:31 +1300
Message-ID <9qe456FfoaU1@mid.individual.net> (permalink)
References <17823047.699.1329714548355.JavaMail.geo-discussion-forums@pbgq3>

Show all headers | View raw


On 02/20/12 06:09 PM, Stanley Rice wrote:
> If a member function is defined within the class body, the member function
> is default inlined. However, if I want to define the function is a separate
> file with other un-inlined function, Lippman said in C++ Primer that it is
> ok. Just prefix the inline keyword in preceed the function definition.
> However, It doesn't work for my compiler, gcc 4.4.3, and my compile option
> is -Wall -Wextra -g -std=c++98

If you are defining a member function outside of the class definition, 
don't bother with inline, let the optimiser do its job.  The only time 
you will need (to prevent multiple definition link errors) it is if you 
define the member function in a header file.

-- 
Ian Collins

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

how to inline member function is a separate file Stanley Rice <heconghui@gmail.com> - 2012-02-19 21:09 -0800
  Re: how to inline member function is a separate file Ian Collins <ian-news@hotmail.com> - 2012-02-20 18:31 +1300
  Re: how to inline member function is a separate file Jun Fang <heyfng@gmail.com> - 2012-02-20 02:16 -0800
  Re: how to inline member function is a separate file Juha Nieminen <nospam@thanks.invalid> - 2012-02-20 10:26 +0000
  Re: how to inline member function is a separate file "Bo Persson" <bop@gmb.dk> - 2012-02-22 20:16 +0100
    Re: how to inline member function is a separate file Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-22 20:29 +0000
      Re: how to inline member function is a separate file Robert Wessel <robertwessel2@yahoo.com> - 2012-02-22 21:42 -0600

csiph-web