[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] inline vs. #define
From: |
Geoffrey Wossum |
Subject: |
Re: [avr-gcc-list] inline vs. #define |
Date: |
Wed, 26 Mar 2003 08:50:16 -0600 |
User-agent: |
KMail/1.5 |
On Wednesday 26 March 2003 01:32 am, David Brown wrote:
> function, just in case another C module wants to use it. The normal way to
> make always-inlinded functions is to declare them "static inline" - then
> the compiler knows that they will never be used externally, and can avoid
> generating the original function. "Static inline" functions are safe to
> put in headers too - they are then as small and fast as a macro, with all
> the advantages of a function (improved readability, and improved
> compile-time checking).
I always use "extern inline" in headers. I seem to remember reading this in
the gcc manual somewhere. I'm guessing it's the same effect as far as
generated code, but it seems like "static inline" would cause extraneous
warnings. If you had a "static inline" in a header file, included it in a
source file, and never called the function, then I would expect the compiler
to give an error about "foo declared static but never referenced."
Anyone know if these are equivalent, or what the preferred way is?
---
Geoffrey Wossum
Software Engineer
Long Range Systems - http://www.pager.net