Hacker News new | past | comments | ask | show | jobs | submit login

Yes, exactly. Nobody should be surprised that calling `strlen(NULL)` crashes. Checking for NULL at the top of strlen() would be stupid, which is why it doesn't do that. I've seen a lot of so-called "enterprise" code does that, and it's absolutely idiotic.



Okay. But that's totally unrelated to my original point, which is that we are already very used to functions that do not accept the full domain of a given type. "I don't accept nullptr" is not too fundamentally different from "I don't accept "0x8000..."


"I don't accept {nullptr, 0x8000}" is fundamentally different from "{nullptr, 0x8000} is a trap representation".

If it's a trap representation, you can't even pass it to me so that I could accept or reject it.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: