{"id":2412,"date":"2018-06-02T18:27:13","date_gmt":"2018-06-02T09:27:13","guid":{"rendered":"https:\/\/www.chihayafuru.jp\/tech\/?p=2412"},"modified":"2018-06-03T09:50:20","modified_gmt":"2018-06-03T00:50:20","slug":"gcc-%e8%ad%a6%e5%91%8a%e3%82%92%e4%b8%80%e9%83%a8%e5%88%86%e3%81%a7%e6%8a%91%e6%ad%a2%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/archives\/2412","title":{"rendered":"[gcc] \u8b66\u544a\u3092\u4e00\u90e8\u5206\u3067\u6291\u6b62\u3059\u308b"},"content":{"rendered":"<p>\u30b3\u30f3\u30d1\u30a4\u30eb\u8b66\u544a(warning)\u3092\u4e00\u90e8\u5206\u3067\u6291\u6b62\u3059\u308b<\/p>\n<p><!--more--><\/p>\n<h3>\u8b66\u544a\u304c\u767a\u751f\u3059\u308b\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9<\/h3>\n<pre class=\"nums:true lang:c decode:true \" >#include &lt;stdio.h&gt;\r\n#include &lt;stdlib.h&gt;\r\n\r\nint main(void) {\r\n  int x = 1, y;\r\n  y = (x++)*(x++);\r\n  printf(\"x = %d, y = %d\\n\", x, y);\r\n  return (EXIT_SUCCESS);\r\n}<\/pre>\n<h3>\u8b66\u544a\u306e\u4f8b<\/h3>\n<pre class=\"lang:sh decode:true \" >$ gcc -Wall main.c\r\nmain.c: In function \u2018main\u2019:\r\nmain.c:6:9: warning: operation on \u2018x\u2019 may be undefined [-Wsequence-point]\r\n   y = (x++)+(x++);\r\n         ^<\/pre>\n<h3>pragma\u547d\u4ee4\u3067\u8b66\u544a\u3092\u6291\u6b62\u3057\u305f\u4f8b<\/h3>\n<pre class=\"nums:true lang:c decode:true \" >#include &lt;stdio.h&gt;\r\n#include &lt;stdlib.h&gt;\r\n\r\nint main(void) {\r\n  int x = 1, y;\r\n#pragma GCC diagnostic ignored \"-Wsequence-point\"\r\n  y = (x++)*(x++);\r\n#pragma GCC diagnostic warning \"-Wsequence-point\"\r\n  printf(\"x = %d, y = %d\\n\", x, y);\r\n  return (EXIT_SUCCESS);\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u30b3\u30f3\u30d1\u30a4\u30eb\u8b66\u544a(warning)\u3092\u4e00\u90e8\u5206\u3067\u6291\u6b62\u3059\u308b<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[57],"class_list":["post-2412","post","type-post","status-publish","format-standard","hentry","category-memo","tag-gcc"],"_links":{"self":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/2412","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/comments?post=2412"}],"version-history":[{"count":6,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/2412\/revisions"}],"predecessor-version":[{"id":2418,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/2412\/revisions\/2418"}],"wp:attachment":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/media?parent=2412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/categories?post=2412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/tags?post=2412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}