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

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: how to inline member function is a separate file
Date Mon, 20 Feb 2012 18:31:01 +1300
Lines 15
Message-ID <9qe456FfoaU1@mid.individual.net> (permalink)
References <17823047.699.1329714548355.JavaMail.geo-discussion-forums@pbgq3>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net zs2cvDZcOBAngn4wPh1LTwZgg5UTEnK/AcY7pWDoV0ubfdHGYK
Cancel-Lock sha1:ewbuBgQ7/A1XDTXhzclTBKFNvCU=
User-Agent Mozilla/5.0 (X11; SunOS i86pc; rv:7.0.1) Gecko/20111228 Thunderbird/7.0.1
In-Reply-To <17823047.699.1329714548355.JavaMail.geo-discussion-forums@pbgq3>
Xref x330-a1.tempe.blueboxinc.net comp.lang.c++:14306

Show key headers only | 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