Date: Sun, 09 Sep 2001 14:31:21 +0300 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: "Raf256" Message-Id: <2593-Sun09Sep2001143121+0300-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9 CC: djgpp AT delorie DOT com In-reply-to: <3b9b36a7$1@news.vogel.pl> (raf256@go2.pl) Subject: Re: ilnine ? References: <3b9b36a7$1 AT news DOT vogel DOT pl> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: "Raf256" > Newsgroups: comp.os.msdos.djgpp > Date: Sun, 9 Sep 2001 11:29:37 +0200 > > why use 'inline' statment ? If compiler is good enought, it sholud give same > result if functions are and aren't inline, when optimization for speed is > checked... The compiler won't inline functions unless you use the "-O3" switch. However, the current optimization technology is not smart enough to find functions that can benefit from inlining. So the compiler inlines all the function in sight, and that generally makes your program slower. For that reason, you are well advised to compile with "-O2" (which does not inline automatically), but declare inline only those functions you know are will be called in the inner loops. The above is true for C programs. Things are a bit different in C++, where class methods are inlined even with "-O2", as if they were declared inline.