4 ms·
I was shocked to learn that reaching an end of a function without returning is actually UB and the compiler doesn't stop you; only warns. For example: ``` cla
by xdavidliu 3y ago
I was shocked to learn that reaching an end of a function without returning is actually UB and the compiler doesn't stop you; only warns. For example:
```
class Foo;
Foo get_foo() {
std::cout << "whoops, I forgot to return\n";
}
int main() {
const auto foo = get_foo();
}
```