tag:blogger.com,1999:blog-3636872937372639901.post6507178213658198899..comments2024-03-29T16:37:25.385+09:00Comments on 本の虫: C++03とC++11の違い:言語サポートライブラリ編江添亮http://www.blogger.com/profile/13387122818743087721noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-3636872937372639901.post-55668778896021136062013-12-27T15:12:22.637+09:002013-12-27T15:12:22.637+09:00> std::operator newではなく、普通のユーザー定義のoperator newで...> std::operator newではなく、普通のユーザー定義のoperator newでした。 <br /><br />std::operator new というものはありません。ライブラリ提供のデフォルト版もグローバル名前空間にあります。( operator new がグローバル以外の名前空間から探索されることはありません)<br /><br />「普通のユーザー定義のoperator new」がユーザーが置き換え版として定義したものを指すのであれば、そちらも同じ "Required behavior" に従う必要がある(さもなければ未定義の結果を生じる)とされています。 17.6.4.8 [res.on.functions] p2<br />> In particular, the effects are undefined in the following cases:<br />> - for replacement functions (18.6.1), if the installed replacement<br />> function does not implement the semantics of the applicable Required<br />> behavior: paragraph.<br /><br />独自の引数を追加したものやクラスのメンバである operator new が投げる例外の種類に規定は無いようですが、それは C++03 でも同じです。<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3636872937372639901.post-83081241952571756842013-12-27T07:57:24.995+09:002013-12-27T07:57:24.995+09:00std::operator newではなく、普通のユーザー定義のoperator newでした。std::operator newではなく、普通のユーザー定義のoperator newでした。江添亮https://www.blogger.com/profile/13387122818743087721noreply@blogger.comtag:blogger.com,1999:blog-3636872937372639901.post-87168998882119778282013-12-27T01:54:42.349+09:002013-12-27T01:54:42.349+09:00> 変更:std::operator newがstd::bad_alloc以外の例外も投げるか...> 変更:std::operator newがstd::bad_alloc以外の例外も投げるかもしれないようになった<br /><br />そんなことは無いですよ。 N3797 18.6.1.1 [new.delete.single] p3<br />> Required behavior: Return a non-null pointer to suitably aligned<br />> storage (3.7.4), or else throw a bad_alloc exception.Anonymousnoreply@blogger.com