fork(2) download
  1. const char * global_name;
  2.  
  3. bool foo(const std::string name)
  4. {
  5. new_foo(name.c_str());
  6. }
  7.  
  8. void new_foo(const char* name)
  9. {
  10. global_name = name; // this makes global_name a dangling pointer, because it will still
  11. // exist after the string in foo is destroyed
  12. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty