执行内联函数时是否存在堆栈关联? [英] Is there stack associated when a executing an inline function?

查看:137
本文介绍了执行内联函数时是否存在堆栈关联?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要知道在执行

内联函数执行时是否生成堆栈帧或

它们是否只执行像宏一样?

如果它们像宏一样执行,那么需要什么才能拥有

内联函数?

你在哪里使用宏? inlines?


谢谢

Mahesh

Hi,
I need to know if stack frames are generated in case of a
inline function execution or
do they execute just like macros?
if they execute like macros, then what is the need for having
inline function?
where would you use macros and where inlines?

Thanks
Mahesh

推荐答案

在文章< fq **********@registered.motzarella.org>,

santosh< sa ********* @ gmail.comwrote:
In article <fq**********@registered.motzarella.org>,
santosh <sa*********@gmail.comwrote:

>如果它们像宏一样执行,那么有什么需要内联函数?
> 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.



您通常不会丢失使用宏的类型检查,因为

扩展会以通常的方式检查类型。如果getc是一个宏并且你用一些不是FILE *的东西来调用它,你可能会得到一堆致命的,如果不清楚的话。


内联函数更令人信服的原因是你不能使用表达式中使用的宏中的任意构造。

C'的宏只是强大到足以让你编写getc和putc,

但是任何需要声明或循环的东西都无法完成。


- Richard

-

:wq

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


文章< 1f * ******** @ u10g2000prn。 googlegroups.com>,

Mahesh< ma ******** @ gmail.comwrote:
In article <1f**********************************@u10g2000prn. googlegroups.com>,
Mahesh <ma********@gmail.comwrote:

>

我需要知道在内联函数执行时是否生成堆栈帧,或者它们是否像宏一样执行?

如果它们像宏一样执行,那么有什么需要内联函数?
你在哪里使用宏和内联?

谢谢
Mahesh
>Hi,
I need to know if stack frames are generated in case of a
inline function execution or
do they execute just like macros?
if they execute like macros, then what is the need for having
inline function?
where would you use macros and where inlines?

Thanks
Mahesh



请注意使用stack这个词。在这个ng(即使主题是

煎饼),由非Clique成员,将导致frmage。

Be aware that use of the word "stack" in this ng (even if the subject is
pancakes), by non-Clique members, will result in flamage.


Kenny McCormack写道:
Kenny McCormack wrote:

请注意使用stack这个词。在这个ng(即使主题是

煎饼),由非Clique成员,将导致flamage。
Be aware that use of the word "stack" in this ng (even if the subject is
pancakes), by non-Clique members, will result in flamage.



好​​点 - 很多新手都不知道并非所有的机器都支持堆栈机制。


火焰通常用于智力自负的类型

谁将无知视为美德。


-

Morris Dovey

DeSoto Solar

德索托,爱荷华州美国
http://www.iedu.com/DeSoto


这篇关于执行内联函数时是否存在堆栈关联?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆