本文介绍了需要专家建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




有谁能让我知道如何写一个无限循环,这样

程序永远不会崩溃?


我猜,缓冲区溢出方法mite help!不确定。


Plz让我知道。


-thanks和问候,


Gsec

Hi,

Can anybody let me know how to write a infinite loop, such that the
program never crashes ?

I, guess, buffer overflow method mite help!Not sure.

Plz let me know.

-thanks and regards,

Gsec

推荐答案




哦,对不起。我没有意识到你想让Plz帮助你。哦,好吧......



Oh, sorry. I didn''t realise you wanted Plz to help you. Oh, well...




选择你的毒药:

for(;;){/ *无论* /} 做{/ *什么* /}而(1);

inf_label:
/ *无论* /
goto inf_label;

当然你必须确保{/ *无论* /}没有崩溃。



Pick your poison:

for ( ; ; ) { /* whatever */ }
while ( 1 ) { /* whatever */ }
do { /* whatever */ } while ( 1 );

inf_label:
/* whatever */
goto inf_label;

Of course you have to make sure that { /* whatever */ } does not
crash.



我不知道缓冲区溢出与infinte循环有什么关系。我甚至对螨虫更感到困惑。



I don''t know what buffer overflow has to do with infinte loop. I''m even
more baffled by mites.



哦,对不起。我没有意识到你想让Plz帮助你。哦,好吧......



Oh, sorry. I didn''t realise you wanted Plz to help you. Oh, well...









我认为你想在无限循环中插入代码?并且,你会像未提及的代码一样从未提及的代码中恢复出来的任何错误吗?

我想你想要问......


如果是这样,你需要看看:

1)setjmp(),jmpto()和jmpbuf []尽可能地恢复
SIGINT和SIGABRT来关闭信号to SIG_IGN

3)关闭任何Ctrl-C或Ctrl-break处理,使用一些非标准的

函数,如setcbrk()或break_off()

Rod Pemberton



I take it that you want to insert code in the infinite loop? And, you''d
like the unmentioned code to recover from whatever fault may be generated?
I''m supposing that is you intended to ask...

If so, you need to look at:
1) setjmp(), jmpto() and jmpbuf[] to restore as much as possible of the
pre-fault execution context
2) signal() for turning off signals, by setting SIGBREAK (or SIGQUIT),
SIGINT, and SIGABRT to SIG_IGN
3) turning off any Ctrl-C or Ctrl-break handling, using some non-standard
function, like setcbrk() or break_off()
Rod Pemberton


这篇关于需要专家建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 05:27