{"id":6947,"date":"2018-06-11T14:04:56","date_gmt":"2018-06-11T05:04:56","guid":{"rendered":"http:\/\/umezawa.dyndns.info\/wordpress\/?p=6947"},"modified":"2018-11-02T17:22:11","modified_gmt":"2018-11-02T08:22:11","slug":"void-%e3%81%b8%e3%81%ae%e3%82%ad%e3%83%a3%e3%82%b9%e3%83%88%e3%81%af-wold-style-cast-%e3%81%a7%e8%ad%a6%e5%91%8a%e3%81%95%e3%82%8c%e3%81%aa%e3%81%84","status":"publish","type":"post","link":"http:\/\/umezawa.dyndns.info\/wordpress\/?p=6947","title":{"rendered":"void \u3078\u306e\u30ad\u30e3\u30b9\u30c8\u306f -Wold-style-cast \u3067\u8b66\u544a\u3055\u308c\u306a\u3044"},"content":{"rendered":"<p>gcc (g++) \u3084 Clang++ \u306b\u306f -Wold-style-cast \u3068\u3044\u3046\u8b66\u544a\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u3042\u3063\u3066\u3001 C++ \u30b9\u30bf\u30a4\u30eb\u3067\u306f\u306a\u304f C \u30b9\u30bf\u30a4\u30eb\u306e\u30ad\u30e3\u30b9\u30c8\u3092\u3059\u308b\u3068\u8b66\u544a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<blockquote>\n<pre>\r\nintptr_t foo(void* x)\r\n{\r\n    return (intptr_t)x; \/\/ \u8b66\u544a\r\n    \/\/ return reinterpret_cast&lt;intptr_t&gt;(x); \/\/ OK\r\n}\r\n<\/pre>\n<\/blockquote>\n<p>\u3055\u3066\u3001C \u306b\u306f\u672a\u4f7f\u7528\u5909\u6570\u304c\u3042\u308b\u6642\u306b\u8b66\u544a\u3055\u308c\u306a\u3044\u3088\u3046\u306b\u3059\u308b idiom \u3068\u3057\u3066 void \u306b\u30ad\u30e3\u30b9\u30c8\u3059\u308b\u3001\u3068\u3044\u3046\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<blockquote>\n<pre>\r\nint bar(int x)\r\n{\r\n    (void)x;\r\n    return 0;\r\n}\r\n<\/pre>\n<\/blockquote>\n<p>\u3053\u308c\u306f C \u30b9\u30bf\u30a4\u30eb\u30ad\u30e3\u30b9\u30c8\u3067\u3059\u304c\u3001C++ \u3067 -Wold-style-cast \u4e0b\u3067\u3042\u3063\u3066\u3082\u8b66\u544a\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u305d\u3082\u305d\u3082\u306a\u3093\u3067 C \u30b9\u30bf\u30a4\u30eb\u30ad\u30e3\u30b9\u30c8\u3092\u8b66\u544a\u3057\u3088\u3046\u3068\u3044\u3046\u8a71\u306b\u306a\u308b\u304b\u3068\u3044\u3046\u3068\u3001 C \u30b9\u30bf\u30a4\u30eb\u30ad\u30e3\u30b9\u30c8\u306f\u5b9f\u969b\u306e\u6319\u52d5\u306f static_cast \u3060\u3063\u305f\u308a reinterpret_cast \u3060\u3063\u305f\u308a\u3057\u3066\u66d6\u6627\u3067\u5371\u967a\u3067\u3042\u308b\u304b\u3089\u3067\u3059\u3002void \u306b\u30ad\u30e3\u30b9\u30c8\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u5f0f\u306e\u5024\u306f\u5b58\u5728\u3057\u306a\u3044\u305f\u3081\u66d6\u6627\u3067\u3082\u5371\u967a\u3067\u3082\u306a\u3044\u304b\u3089\u3001\u898b\u305f\u76ee C \u30b9\u30bf\u30a4\u30eb\u30ad\u30e3\u30b9\u30c8\u3067\u3042\u3063\u3066\u3082\u8b66\u544a\u3057\u306a\u3044\u3088\u3046\u306b\u300c\u6c17\u3092\u5229\u304b\u305b\u3066\u3044\u308b\u300d\u306e\u3067\u3057\u3087\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>gcc (g++) \u3084 Clang++ \u306b\u306f -Wold-style-cast \u3068\u3044\u3046\u8b66\u544a\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u3042\u3063\u3066\u3001 C++ \u30b9\u30bf\u30a4\u30eb\u3067\u306f\u306a\u304f C \u30b9\u30bf\u30a4\u30eb\u306e\u30ad\u30e3\u30b9\u30c8\u3092\u3059\u308b\u3068\u8b66\u544a\u3055\u308c\u307e\u3059\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"class_list":["post-6947","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6947","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6947"}],"version-history":[{"count":3,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6947\/revisions"}],"predecessor-version":[{"id":7069,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/6947\/revisions\/7069"}],"wp:attachment":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6947"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6947"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6947"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}