迭代的宏函数 [英] macro function with iteration
问题描述
你好
i需要写一个看起来像这样的MACRO函数
"""
do_somthing();
for(int i = 0; i< 100; i ++){do_something_else())}
return(somthing_other_then_those())//双重类型
"""
i知道这通常不会被推荐由宏执行,但是
满足我的需求我需要它。
是否可以创建一个宏功能呢?怎么样?
谢谢
amit man
am******@gmail.com 写道:
你好
i需要写一个看起来像这样的MACRO函数
"""
do_somthing();
for(int i = 0; i< 100; i ++){do_something_else())}
return(somthing_other_then_those())/ /双重类型
"""
i知道这通常不会被推荐由宏执行,但是
满足我的需求我需要它。
为什么?具体。
是否可以创建一个宏功能呢?怎么样?
" macro"。不是宏功能。 (虽然函数宏是,我认为,看起来像函数调用的宏的术语和
应该表现得像一个。)
-
Chris" electric hedgehog" Dollin
我不明白这是...... Trevor Chaplin,/ Beiderbeck事件/
am ** ****@gmail.com 写于03/07/07 10:01,:
你好
i需要写一个看起来像这样的MACRO函数
""
do_somthing();
for(int i = 0; i< 100; i ++){do_something_else())}
return(somthing_other_then_those())//双重类型
" >
i知道这个通常不会被推荐用宏来执行,但
满足我的需要我需要它。 />
是否可以创建一个宏功能呢?怎么样?
#define AMIT \
do_something(); \\ /
for(int i = 0; i< 100; i ++){do_something_else())} \
return(somthing_other_then_those())
换句话说,你想要完成什么?
-
Er ********* @ sun.com
3月7日下午5:40 ,Chris Dollin< chris.dol ... @ hp.comwrote:
amit .... @ gmail.com写道:
Hello
i需要写一个看起来像这样的MACRO函数
< blockquote class =post_quotes>
""
do_somthing();
for(int i = 0; i< 100; i ++) {do_something_else())}
return(somthing_other_then_those())//双重类型
"""
i知道这通常不推荐由宏执行,但
满足我的需求我需要它是。
为什么?具体。
是否可以创建一个宏功能呢?怎么样?
" macro"。不是宏功能。 (虽然函数宏是,我认为,看起来像函数调用的宏的术语和
应该表现得像一个。)
-
Chris" electric hedgehog" Dollin
我不明白这是...... Trevor Chaplin,/ Beiderbeck事件/
Chris,谢谢你的回放。
i有一个我需要的作业为不同的
任务计算CPU周期(我使用一些lib)。由于任务非常小,我会检查每次任务需要花费大量的时间来完成这些任务。
因为我想排除形式计数,时间消耗由
迭代过程本身(for循环),我需要为
$ b执行此操作$ b每个许多不同的测试任务,我想创建一个宏 -
注册初始周期计数,运行一个空循环,检查当前周期
计数并返回差异。
我想使用宏而不是函数,因为调用
函数似乎会影响计算机使用的周期数。
amit
Hello
i need to write a MACRO function that look something like this
"""
do_somthing();
for(int i=0;i<100;i++) {do_something_else())}
return(somthing_other_then_those()) // a double type
"""
i know this is usauly not recmended to be carried out by a macro, but
for my needs i need it to be.
is it possible to create a macro function that do that? how?
thank you
amit man
am******@gmail.com wrote:
Hello
i need to write a MACRO function that look something like this
"""
do_somthing();
for(int i=0;i<100;i++) {do_something_else())}
return(somthing_other_then_those()) // a double type
"""
i know this is usauly not recmended to be carried out by a macro, but
for my needs i need it to be.Why? Be specific.
is it possible to create a macro function that do that? how?"macro". Not "macro function". (Although "function macro" is, I
think, the term for a macro that looks like a function call and
is supposed to behave like one.)
--
Chris "electric hedgehog" Dollin
"What I don''t understand is this ..." Trevor Chaplin, /The Beiderbeck Affair/
am******@gmail.com wrote On 03/07/07 10:01,:Hello
i need to write a MACRO function that look something like this
"""
do_somthing();
for(int i=0;i<100;i++) {do_something_else())}
return(somthing_other_then_those()) // a double type
"""
i know this is usauly not recmended to be carried out by a macro, but
for my needs i need it to be.
is it possible to create a macro function that do that? how?#define AMIT \
do_something(); \
for(int i=0;i<100;i++) {do_something_else())} \
return(somthing_other_then_those())
In other words, what are you trying to accomplish?
--
Er*********@sun.com
On Mar 7, 5:40 pm, Chris Dollin <chris.dol...@hp.comwrote:amit....@gmail.com wrote:Hello
i need to write a MACRO function that look something like this
"""
do_somthing();
for(int i=0;i<100;i++) {do_something_else())}
return(somthing_other_then_those()) // a double type
"""
i know this is usauly not recmended to be carried out by a macro, but
for my needs i need it to be.
Why? Be specific.
is it possible to create a macro function that do that? how?
"macro". Not "macro function". (Although "function macro" is, I
think, the term for a macro that looks like a function call and
is supposed to behave like one.)
--
Chris "electric hedgehog" Dollin
"What I don''t understand is this ..." Trevor Chaplin, /The Beiderbeck Affair/Hi Chris, thanks for replaying.
i have an assignment in which i need to count CPU cycles for different
tasks (i use some lib for that). since the tasks are very small i
check the amount of time it takes to carry a large number of
iterations of each task.
since i want to exclude form the counting, the time consume by the
iteration process itself (the "for" loop), and i need to do this for
each many different tested tasks, i want to create a macro that -
register inital cycle count, run a empty loop, check the current cycle
count and return the difference.
I want to use a macro and no a function, because calling for a
function seems effect the amount of cycles the computer uses.
amit
这篇关于迭代的宏函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!