Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次のコードを検討してください。
int main() { int *i = nullptr; delete i; }
質問:
C++ で NULL ポインターを削除すると、未定義の動作と見なされますか?
いいえ、これは完全に合法的な操作です。
N3242から、[expr.delete]
delete のオペランドの値は null ポインター値の可能性があります