int w(int x, int y){
if(x != y) {
w(x, y);
}else return x+y;
}
Run Code Online (Sandbox Code Playgroud)
这样称呼它:
w(0, 5);
Run Code Online (Sandbox Code Playgroud)
对于不同的值(如上所述),它会生成无限递归.问题是,一旦程序以这种方式启动,特定进程就会变成D模式(等待内部I/O,因此无法触及).
while(1){
if(0 != 5){
//foo
}else{
//bar
}
}
Run Code Online (Sandbox Code Playgroud)
生成R状态模式 - 完全能够获得SIGKILL.
虽然正常循环在性能方面优于递归; 系统应该仍然能够杀死进程.
为什么会这样?以及如何远程预防?
代码将由程序执行编译,该程序通过套接字将其输出返回给webclient.因此无法控制用户尝试编译的内容.
编辑:
无处不在的编译和运行代码的过程:
$ g++ main.cpp -o m
$ ./m
Run Code Online (Sandbox Code Playgroud)
EDIT2:
$ g++ --version
g++ (GCC) 4.9.2 20150204 (prerelease)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY …
Run Code Online (Sandbox Code Playgroud) 根据官方网站,Mono现在支持System.Speech(5.0).但是,我无法访问5.0版本的Linux版本
"MonoDevelop 5.0.0.878的软件包尚不可用.最新版本是MonoDevelop 4.2.1"
有没有办法实现这个目标?(tarballs,git?)
笔记
我正在寻找一种在C#中获取此过程结果的方法.确切地说,我试图根据给定的格式从二进制字符串中解包数据(该方法应该返回一个数组).有关更多信息,请参阅http://docs.python.org/2/library/struct.html.
struct.unpack('!hh', data[2:6])
Run Code Online (Sandbox Code Playgroud)
有没有办法在C#中这样做?