All Questions
1 question
1
vote
1
answer
252
views
Why can't compilers optimize-out this std::string construction?
Consider the following code:
#include <string>
#include <cstring>
size_t foo(const char* cptr)
{
if (cptr == nullptr) { return 0; }
return strlen(cptr);
}
size_t bar()
{
...