c++ - Stack runtime error -
#include <stack> #include <functional> int main() { std::stack<std::function<int()>> s; s.push(main); return s.top()(); }
i following diagnostic:
result: runtime error time: 0.04s memory: 39704 kb signal: 11 (sigsegv)
what's going on here?
first, aren't allowed call main
yourself. secondly, appears doing "what you'd expect" , making call, you're causing infinite recursion uses stack space , overflows it.
Comments
Post a Comment