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

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -