是否可以修改C++中的调用栈? (我知道这是一个可怕的想法和我真的只是想知道----我不打算实际上这样做)修改调用栈
例如:
void foo(){
other();
cout << "You never see this" << endl; //The other() function modifies the stack to
//point to what ever called this function...so this is not displayed
}
void other(){
//modify the stack pointer here somehow to go down 2 levels
}
//Elsewhere
foo();
是的,你可以。但是你需要知道堆栈帧是什么样的。这是编译器和平台的依赖。你使用的是什么操作系统和编译器? –
1.抛出一个异常,2'setjmp' /'longjmp' –
@RichardHodges我真的只要求好奇的缘故(所以我实际上没有一个需要解决的问题) – DarthRubik