[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] question about inline function
From: |
Wesley J Landaker |
Subject: |
Re: [avr-gcc-list] question about inline function |
Date: |
Sun, 18 Aug 2002 09:44:58 -0600 |
User-agent: |
KMail/1.4.2 |
On Sunday 18 August 2002 12:16 am, Frantz Capiez wrote:
> Hi,
>
> I'am trying to place in my code, inline function. The prototype is
> declared as:
>
> extern inline char foo(void) __attribute__ ((always_inline));
First of all, extern and inline don't make sense together. It's legal,
but the "inline" part will be completely ignored.
> and function declared in .c is:
>
> inline char foo(void)
> {
> ...
> }
> compiler (gcc3.2) doesn't declare warning but my function is never
> used as inline but simply called. I don't understand why. (same
> behavior if I declare a static inline function inside a module,
> function is called not 'inlined').
Make sure the inlined function is in the same compilational unit as
where it is called. For example, if you have main.c and funcs.c and you
call an "inline" function from funcs.c in main.c it will never be
inlined.
Typically, an inline function should be *defined* (not just
declared)either in the file where it is used, or directly inside the
header file.
--
Wesley J. Landaker - address@hidden
OpenPGP FP: C99E DF40 54F6 B625 FD48 B509 A3DE 8D79 541F F830
avr-gcc-list at http://avr1.org