Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- struct A
- {
- std::string foo() const{ return "aaa"; }
- };
- void bar(const char* c) {
- std::cout << c;
- }
- int main()
- {
- A a;
- bar(a.foo().c_str()); // Is this safe?
- bar(a.foo().substr().c_str()); // or this
- }
Advertisement
Add Comment
Please, Sign In to add comment