MACRO和功能之间的区别 [英] Difference between a MACRO and a FUNCTION

查看:80
本文介绍了MACRO和功能之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



可以列出一个函数

和一个宏之间可能存在的差异吗?

哪一个更快,为什么??


ex:函数和宏ti找到最多两个nums

#define MAX(a,b)(a> b)? a:b




int max(int a,int b)

解决方案

MAx写道:




可以列出任何一个函数之间可能存在的差异数量/>
和宏?



家庭作业?


哪一个会更快,为什么?


答案是或者两者都没有。


-

Ian Collins。


MAx写道:




可以列出任何一个函数之间可能存在的差异数量

和一个宏?

哪一个会更快,为什么?



我闻到作业味吗?


9月20日晚上1:10,Mark Bluemel< mark_blue ... @ pobox.comwrote:


MAx写道:




可以任意一个列出函数

和宏之间可能存在的差异吗?

哪一个会更快,为什么?



我闻到作业的味道吗?



显然不是家庭作业。

这是一个面试问题...

i我正在寻找一个令人印象深刻的回答。


Hi,
Could any one list possible number of diferences between a function
and a macro?
which one will be faster and why??

ex : function and a macro ti find max of two nums
#define MAX(a,b) (a>b) ? a:b

and
int max(int a,int b)

解决方案

MAx wrote:

Hi,
Could any one list possible number of diferences between a function
and a macro?

Homework?

which one will be faster and why??

The answer is either or neither.

--
Ian Collins.


MAx wrote:

Hi,
Could any one list possible number of diferences between a function
and a macro?
which one will be faster and why??

Do I smell homework?


On Sep 20, 1:10 pm, Mark Bluemel <mark_blue...@pobox.comwrote:

MAx wrote:

Hi,
Could any one list possible number of diferences between a function
and a macro?
which one will be faster and why??


Do I smell homework?

obviously not a homework.
this was an interview question...
i am looking for an impressive answer.


这篇关于MACRO和功能之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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