{"id":3918,"date":"2013-05-26T20:38:31","date_gmt":"2013-05-26T11:38:31","guid":{"rendered":"http:\/\/umezawa.dyndns.info\/wordpress\/?p=3918"},"modified":"2013-05-26T23:32:45","modified_gmt":"2013-05-26T14:32:45","slug":"%e3%80%8c%e3%82%b9%e3%82%bf%e3%83%86%e3%82%a3%e3%83%83%e3%82%af-const-%e6%95%b4%e6%95%b0%e3%83%87%e3%83%bc%e3%82%bf-%e3%83%a1%e3%83%b3%e3%83%90%e4%bb%a5%e5%a4%96%e3%82%92%e3%82%af%e3%83%a9%e3%82%b9","status":"publish","type":"post","link":"http:\/\/umezawa.dyndns.info\/wordpress\/?p=3918","title":{"rendered":"\u300c\u30b9\u30bf\u30c6\u30a3\u30c3\u30af const \u6574\u6570\u30c7\u30fc\u30bf \u30e1\u30f3\u30d0\u4ee5\u5916\u3092\u30af\u30e9\u30b9\u5185\u3067\u521d\u671f\u5316\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u300d"},"content":{"rendered":"<p>\u3053\u3093\u306a\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3068\u3001Visual C++ 2005 \u3067\u306f\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<blockquote>\n<pre>#include &lt;stdio.h&gt;\r\nclass A { public: static const float a = 1.0; };\r\nint main(void)\r\n{\r\n    printf(\"%f\\n\", A::a);\r\n    return 0;\r\n}<\/pre>\n<\/blockquote>\n<blockquote>\n<pre>a.cpp(2) : error C2864: 'A::a' : \u30b9\u30bf\u30c6\u30a3\u30c3\u30af const \u6574\u6570\u30c7\u30fc\u30bf \u30e1\u30f3\u30d0\u4ee5\u5916\u3092\u30af\u30e9\u30b9\u5185\u3067\u521d\u671f\u5316\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093<\/pre>\n<\/blockquote>\n<p>\u69cb\u9020\u4f53\u3068\u304b\u306a\u3089\u3057\u3087\u3046\u304c\u306a\u3044\u3068\u3057\u3066\u3001float \u3050\u3089\u3044\u521d\u671f\u5316\u3055\u305b\u3066\u304f\u308c\u3088\u3068\u601d\u3046\u308f\u3051\u3067\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<p>GCC (gcc-c++-4.1.2-54.el5) \u3067 -std=c++98 \u3060\u3068\u3069\u3046\u304b\u306a\u3041\u3068\u601d\u3063\u3066\u8a66\u3057\u3066\u307f\u308b\u3068\u3001\u30a8\u30e9\u30fc\u3069\u3053\u308d\u304b -Wall -Wextra \u3067\u3082\u8b66\u544a\u306b\u3082\u306a\u3089\u305a\u671f\u5f85\u901a\u308a\u306e\u52d5\u4f5c\u306b\u306a\u308a\u307e\u3059\u3002\u6700\u9069\u5316\u3092\u304b\u3051\u308b\u3068\u3061\u3083\u3093\u3068\u6570\u5024\u304c\u30a4\u30f3\u30e9\u30a4\u30f3\u5c55\u958b\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u3058\u3083\u3042\u30b3\u30f3\u30d1\u30a4\u30e9\u304c\u53e4\u3044\u305b\u3044\u304b\u306a\u3001\u3068\u3044\u3046\u3053\u3068\u3067\u3001Visual C++ 2008\/2010\/2012 \u3067\u8a66\u3057\u305f\u3068\u3053\u308d\u3001\u3084\u3063\u3071\u308a\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002\u3048\u30fc\u305d\u3093\u306a\u3002<\/p>\n<p>\u3082\u3061\u308d\u3093\u30af\u30e9\u30b9\u5ba3\u8a00\u306e\u5916\u3067\u521d\u671f\u5316\u3059\u308c\u3070\u30a8\u30e9\u30fc\u306b\u306f\u306a\u3089\u306a\u3044\u308f\u3051\u3067\u3059\u304c\u3001\u521d\u671f\u5316\u304c\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u5185\u306b\u3042\u308b\u3068 include \u3057\u305f\u30b3\u30f3\u30d1\u30a4\u30eb\u5358\u4f4d\u3054\u3068\u306b\u5b9f\u4f53\u304c\u8907\u6570\u751f\u6210\u3055\u308c\u3066\u3057\u307e\u3063\u3066\u30ea\u30f3\u30af\u30a8\u30e9\u30fc\u306b\u306a\u308a\u3001\u30bd\u30fc\u30b9\u30d5\u30a1\u30a4\u30eb (*.cpp) \u5185\u306b\u3042\u308b\u3068\u6700\u9069\u5316\u6642\u306b\u6570\u5024\u3092\u30a4\u30f3\u30e9\u30a4\u30f3\u5c55\u958b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002\u3042\u30682\u304b\u6240\u306b\u66f8\u304f\u3053\u3068\u306b\u306a\u3063\u3066\u30c0\u30b5\u3044\u3002<\/p>\n<p>\u3046\u30fc\u3093\u2026<\/p>\n<p>\u306a\u304a\u3001\u79c1\u304c\u3084\u308a\u305f\u3044\u3053\u3068\u3068\u3057\u3066\u306f\u5909\u6570\u306e\u5b9f\u4f53\u304c\u751f\u6210\u3055\u308c\u308b\u5fc5\u8981\u306f\u306a\u3044\uff08\u30a4\u30f3\u30e9\u30a4\u30f3\u5c55\u958b\u3055\u308c\u308c\u3070\u305d\u308c\u3067\u3044\u3044\uff09\u305f\u3081\u3001\u6b21\u5584\u306e\u7b56\u3068\u3057\u3066\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u65b9\u6cd5\u304c\u53d6\u308c\u307e\u3059\u3002<\/p>\n<blockquote>\n<pre>#include &lt;stdio.h&gt;\r\nclass A { public: static inline float a() { return 1.0; } };\r\nint main(void)\r\n{\r\n    printf(\"%f\\n\", A::a());\r\n    return 0;\r\n}<\/pre>\n<\/blockquote>\n<p>\u3053\u308c\u3060\u3068\u671f\u5f85\u901a\u308a\u306e\u52d5\u4f5c\u306b\u306a\u308b\u3057\u3061\u3083\u3093\u3068\u30a4\u30f3\u30e9\u30a4\u30f3\u5c55\u958b\u3055\u308c\u307e\u3059\u3002\u30ab\u30c3\u30b3\u304c\u90aa\u9b54\u3067\u3059\u304c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306a\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3068\u3001Visual C++ 2005 \u3067\u306f\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002 #include &lt;stdio.h&gt; class A { public: static const float a = 1.0;  [&hellip;]<\/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-3918","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\/3918","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=3918"}],"version-history":[{"count":14,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3918\/revisions"}],"predecessor-version":[{"id":3932,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3918\/revisions\/3932"}],"wp:attachment":[{"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3918"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3918"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/umezawa.dyndns.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3918"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}