问题描述
任何编程语言的语法都说当一个函数被另一个函数调用时,被调用者执行它后会被调用身体应该
返回它留在呼叫者的位置..
是否有任何技术让被叫者返回其他人
点(在当前进程内)通过改变
被调用者的调用栈...
我的代码在86处理器上运行
(如果这个帖子对这个组无关紧要请恭喜
一样)
提前感谢
语法说没有这样的事情。语法只描述语法;
运行时发生的事情是语义问题。
使用INTERCAL,它有一个COME FROM语句就是为了这个目的。
或者,使用函数式编程语言,让你使用
显式延续并调用继续而不是返回。
如果你努力的话,这两个都可以用(正确的,便携的)C来完成,
但你不要''我想做那件事。要么重新设置问题以适应您的
工具,要么选择适合您问题的工具。
dave
-
Dave Vandervies
他不会以某种方式打击我作为学习者。让我们希望我们错了。
- 在comp.lang.c中的理查德希思菲尔德
语法说没有这样的事情。语法只描述语法;
运行时发生的事情是语义问题。
使用INTERCAL,它有一个COME FROM语句就是为了这个目的。
或者,使用函数式编程语言,让你使用
显式延续并调用继续而不是返回。
如果你努力的话,这两个都可以用(正确的,便携的)C来完成,
但你不要''我想做那件事。要么重新构建问题以适应您的
工具,要么选择适合您问题的工具。
我不太同意这种反转向的心态。
在某些情况下,setjmp和longjmp是实际上好于
重新解决这个问题。
德成
使用INTERCAL,它有一个COME FROM语句用于此目的。
或者,使用函数式编程语言,它允许您使用
显式延续并调用延续而不是返回。 br />
这两个都可以在(正确,便携)C中完成,如果你足够努力,
但你不想这样做。要么重新设置问题以适应您的
工具,要么选择适合您问题的工具。
我不太同意这种反转向的心态。
我在这里看不到反goto心态。
没有足够的信息可以肯定,但问题的方式是b / b
是一个非常强烈暗示的OP正在寻找一些东西
比setjmp / longjmp更少限制。
dave
-
Dave Vandervies
那个只告诉你执行的时间。要计算速度,你将需要知道程序在那段时间内的行程距离。
- 在comp.lang.c中的理查德希思菲尔德
hi,
the grammer for any programming language says that when a function is
called by another function,the callee after executing it''s body should
return to the point where it left in the caller..
Is there any technique to make the callee to return to some other
point(within the current process) other than the callee by changing
the call stack in callee...
My code runs on 86 processor
(If this thread is irrelevent to this group please kindly igore the
same)
thanks in advance
The grammar says no such thing. The grammar only describes syntax;
what happens when it runs is a matter of semantics.
Use INTERCAL, which has a COME FROM statement for precisely this purpose.
Alternatively, use a functional programming language that lets you use
explicit continuations and invoke a continuation instead of returning.
Both of these can be done in (correct, portable) C if you try hard enough,
but You Don''t Want To Do That. Either re-frame the problem to fit your
tools or choose your tools to fit the problem.
dave
--
Dave Vandervies dj******@csclub.uwaterloo.ca
He doesn''t strike me as a learner, somehow. Let''s hope we''re wrong.
--Richard Heathfield in comp.lang.c
The grammar says no such thing. The grammar only describes syntax;
what happens when it runs is a matter of semantics.
Use INTERCAL, which has a COME FROM statement for precisely this purpose.
Alternatively, use a functional programming language that lets you use
explicit continuations and invoke a continuation instead of returning.
Both of these can be done in (correct, portable) C if you try hard enough,
but You Don''t Want To Do That. Either re-frame the problem to fit your
tools or choose your tools to fit the problem.
I don''t quite agree with this anti-goto mentality.
In some cases, setjmp and longjmp are actually better than
reframing the problem.
Tak-Shing
Use INTERCAL, which has a COME FROM statement for precisely this purpose.
Alternatively, use a functional programming language that lets you use
explicit continuations and invoke a continuation instead of returning.
Both of these can be done in (correct, portable) C if you try hard enough,
but You Don''t Want To Do That. Either re-frame the problem to fit your
tools or choose your tools to fit the problem.
I don''t quite agree with this anti-goto mentality.
I see no anti-goto mentality here.
There''s not enough information to be certain, but the way the question
was stated is a pretty strong hint that the OP is looking for something
less restricted than setjmp/longjmp.
dave
--
Dave Vandervies dj******@csclub.uwaterloo.ca
That only tells you the time of execution. To calculate the speed, you will
also need to know the distance the program travels within that time.
--Richard Heathfield in comp.lang.c
这篇关于违反程序调用约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!