3 ms·
Depends on where you're coming from, but some people would expect it to enforce that the pointer is non-null, then proceed. Which would actually give you a guar
by dataflow 8mo ago
Depends on where you're coming from, but some people would expect it to enforce that the pointer is non-null, then proceed. Which would actually give you a guaranteed crash in case it is null. But that's not what it does in C++, and I could see it not being entirely obvious.
- IshKebab 8mo agoAssert doesn't work like that in any language.
- comex 8mo agoIt does in Rust: assert is always enabled, whereas the debug-only version is called debug_assert. But yes, “assert” in most languages is debug-only.
- IshKebab 8mo agoHe said > some people would expect it to enforce that the pointer is non-null, then proceed No language magically makes the pointer non-null and then continues. I don't even know what that would mean.
- dataflow 8mo agoIf you don't even know what that would mean then it's premature to declare that nothing works that way. Understanding the meaning is a prerequisite for that. In this case, it may help to understand that e.g. border control enforces a traveler's permission to cross the border, then lets them proceed.
- deleted 8mo ago[deleted]