4 ms·
AFAIK the lifetime of the temporary is defined as being valid until the statement is done. So even printf("%s\n", obj.to_string().c_str()); should be perf
by jstimpfle 3y ago
AFAIK the lifetime of the temporary is defined as being valid until the statement is done. So even
printf("%s\n", obj.to_string().c_str());
should be perfectly fine.
- gumby 3y agoYou are correct for C++, though I don't know if C makes this commitment.