4 ms·
I remember the first time when I worked on multithreaded C++ project. I allocated a structure on the stack and passed its address to a queue which was received
by pramodliv1 13y ago
I remember the first time when I worked on multithreaded C++ project. I allocated a structure on the stack and passed its address to a queue which was received by another thread and the inevitable segfault happened. My mistake provided a lot of laughs for the entire team.
Also see http://stackoverflow.com/questions/8468210/stack-vs-heap-c http://stackoverflow.com/questions/8468210/stack-vs-heap-c
- ksk 13y agoI understand what you meant but to be a bit pedantic, you can freely allocate structures on the stack and pass it around. You might have heard of a few of them .. cout, cin :P