4 ms·
It's not unsafe as in "memory segmentation fault" unsafe. It's unsafe as in, if you don't follow the rules, the resulting value is ~rand(). For those familiar
by paulddraper 2y ago
It's not unsafe as in "memory segmentation fault" unsafe.
It's unsafe as in, if you don't follow the rules, the resulting value is ~rand().
For those familiar with C/C++ terminology, this is the tame "unspecified behavior" (not the nasal demon "undefined behavior.")
- badmintonbaseba 2y agoNit: "unspecified behavior" isn't a thing, at least without some further qualifications. It's usually "unspecified result", or "unspecified result or trap" for certain operations. "unspecified behavior" without further qualifications is just "undefined behavior". Having said that, an "unspecified result" can still come from anywhere, like a value left in a register from some previous computation or other "garbage" on the stack or heap. This still can be a security issue, even though the behavior is not completely undefined.
- paulddraper 2y agoNit nit: Unspecified behavior is absolutely a thing, reference ISO/IEC 14882:2003 §1.3.13 Unspecified Behavior. The rest is correct.