Skip to main content

All Questions

Filter by
Sorted by
Tagged with
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() { ...
einpoklum's user avatar
  • 130k