Re: Is there stack associated when a executing an inline function?
- From: richard@xxxxxxxxxxxxxxx (Richard Tobin)
- Date: 29 Feb 2008 12:26:00 GMT
In article <fq8jmu$j4j$1@xxxxxxxxxxxxxxxxxxxxxxxxx>,
santosh <santosh.k83@xxxxxxxxx> wrote:
if they execute like macros, then what is the need for having
inline function?
One major advantage (and sometimes a major disadvantage) is the type
checking you get with inline functions.
You generally don't lose type checking with macros, because the
expansion gets type checked in the usual way. If getc is a macro and
you call it with something that isn't a FILE *, you'll probably
get a bunch of fatal, if unclear, errors.
The more compelling reason for inline functions is that you can't
use arbitrary constructs in macros that are used in expressions.
C's macros are just powerful enough to let you write getc and putc,
but anything that needs declarations or a loop can't be done.
-- Richard
--
:wq
.
- References:
- Prev by Date: Re: Link lists..
- Next by Date: Re: Variable-sized lines of text in linked list
- Previous by thread: Re: Is there stack associated when a executing an inline function?
- Next by thread: Re: Is there stack associated when a executing an inline function?
- Index(es):
Relevant Pages
|