delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/03/21:49:39

Date: Tue, 3 Aug 1999 14:13:55 +0200
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Message-Id: <199908031213.OAA09593@acp3bf.physik.rwth-aachen.de>
To: djgpp AT delorie DOT com
Cc: bazramit AT yahoo DOT com
Subject: Re: some questions! (inline, egcs, and others!)
Newsgroups: comp.os.msdos.djgpp
Organization: RWTH Aachen, III. physikalisches Institut B
X-Newsreader: TIN [version 1.2 PL2]
Reply-To: djgpp AT delorie DOT com

In article <19990802173950 DOT 6930 DOT rocketmail AT send205 DOT yahoomail DOT com> you wrote:

> *) when does djgpp accept my request to make a
> function inline, and when does it decline the request!

First of all, it's not 'DJGPP' that makes this decision, it's the
compiler itself, i.e. gcc. GCC has its own internal machinery to
decide if a function can be inlined, or not. It will do this silently,
unless you used the option '-Winline' for compilation. From 'info gcc':

`-Winline'
     Warn if a function can not be inlined, and either it was declared
     as inline, or else the `-finline-functions' option was given.

> *) can i make an external function inline? i.e. the
> function is in file "f1.cc" and the declaration in
> "f2.cc" is like this...
> 	inline void hello();
> will it still be inline'd?

The declaration shouldn't be in "f2.cc", but in the header file
that corresponds to "f1.cc" ("f1.h", by convention).

And no, gcc will not generally be able to do that. If you want the
function inlined, you have to move the *definition* of the function to
'f1.h' as well. See "info gcc 'C Extensions' inline" for the details,
if you're doing this in C. If you're using C++, see your C++ textbook.

> *) if the answer to the prev question is yes... can i
> inline an assembly function? (i.e. a function that is
> written using NASM?)

You can't do it in NASM, because gcc doesn't use NASM, and your inline
assembly would have to become part of the assembly output from gcc.
You *have* to use 'gas' assembly language, for this.

--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019