Guest User

Untitled

a guest
Sep 27th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. struct A
  5. {
  6. std::string foo() const{ return "aaa"; }
  7. };
  8.  
  9. void bar(const char* c) {
  10. std::cout << c;
  11. }
  12.  
  13. int main()
  14. {
  15. A a;
  16. bar(a.foo().c_str()); // Is this safe?
  17. bar(a.foo().substr().c_str()); // or this
  18. }
Advertisement
Add Comment
Please, Sign In to add comment