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

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -