{"id":7980,"date":"2023-07-14T23:55:51","date_gmt":"2023-07-14T14:55:51","guid":{"rendered":"http:\/\/hdmr.org\/d\/?p=7980"},"modified":"2023-07-14T23:55:51","modified_gmt":"2023-07-14T14:55:51","slug":"wp-7980","status":"publish","type":"post","link":"https:\/\/hdmr.org\/d\/wp-7980","title":{"rendered":"goto\u6587\u306e\u3042\u304f\u3069\u3044\u4f7f\u3044\u65b9"},"content":{"rendered":"<p>\u6700\u8fd1\u3001\u4ed5\u4e8b\u3067\u3068\u3042\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u8aad\u3093\u3067\u3044\u305f\u306e\u3060\u304c\u3001<\/p>\n<p>\u3069\u3046\u306b\u3082\u304a\u304b\u3057\u3044\u6c17\u304c\u3057\u305f\u306e\u3067\u8a73\u3057\u304f\u89e3\u6790\u3057\u3066\u3044\u305f\u3089\u3001\u306a\u3093\u3068goto\u6587\u304c\u4f7f\u308f\u308c\u3066\u3044\u305f\u3002<\/p>\n<p>\u305d\u308c\u3082\u306a\u304b\u306a\u304b\u3042\u304f\u3069\u3044\u4f7f\u3044\u65b9\u3067\u3042\u308b\u3002<\/p>\n<hr>\n<p>goto\u6587\u306b\u3064\u3044\u3066\u306f\u591a\u91cd\u30eb\u30fc\u30d7\u3092\u629c\u3051\u308b\u305f\u3081\u306b\u9650\u5b9a\u7684\u306b\u4f7f\u3046\u3088\u3046\u306a\u8a71\u3082\u805e\u304f\u3002<\/p>\n<pre>for(i=0;i&lt;loop;i++){<br>&nbsp;&nbsp; for(j=0;j&lt;loop;j++){<br>&nbsp;&nbsp;&nbsp;&nbsp; if(condition){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; goto LOOP_END;<br>     }<br>&nbsp;&nbsp; }\n}\nLOOP_END:\n<\/pre>\n<p>\u30eb\u30fc\u30d7\u3092\u9014\u4e2d\u3067\u629c\u3051\u308b\u5834\u5408\u3001break\u6587\u3067\u629c\u3051\u3089\u308c\u308b\u304c\u3001<\/p>\n<p>\u30eb\u30fc\u30d7\u30922\u3064\u629c\u3051\u308b\u3053\u3068\u3092\u5358\u7d14\u306b\u66f8\u3051\u306a\u3044\u306e\u3067goto\u3092\u4f7f\u3046\u3053\u3068\u304c\u3042\u308b\u3068\u3002<\/p>\n<p>\u305f\u3060\u3001\u50d5\u81ea\u8eab\u306f\u3053\u3093\u306a\u66f8\u304d\u65b9\u3057\u305f\u3053\u3068\u306f\u306a\u3044\u3057\u3001\u4eca\u307e\u3067\u306e\u4ed5\u4e8b\u3067\u3082\u898b\u308b\u3053\u3068\u306f\u306a\u304b\u3063\u305f\u304c\u3002<\/p>\n<hr>\n<p>\u307e\u305a\u3042\u3063\u305f\u30bf\u30a4\u30d7\u306f\u7d42\u4e86\u51e6\u7406\u3078\u30b8\u30e3\u30f3\u30d7\u3055\u305b\u308b\u3082\u306e\u3002<\/p>\n<pre>while(1){<br>  if(flag1){<br>&nbsp;&nbsp; goto CMD_END:<br>  }<br>  if(flag2){<br>&nbsp;&nbsp;&nbsp; goto CMD_END;\n  }\n  switch(mode){<br>&nbsp;&nbsp; case MODE1:<br>      break;<br>    case MODE2;<br>      break;\n  }\nCMD_END:<br>  close1();<br>}<\/pre>\n<p>\u3053\u3046\u3044\u3046\u66f8\u304d\u65b9\u306f\u6bd4\u8f03\u7684\u3042\u308b\u65b9\u304b\u3082\u3057\u308c\u306a\u3044\u304c\u3002<\/p>\n<p>\u672b\u5c3e\u306b\u3042\u308b\u7d42\u4e86\u51e6\u7406\u306b\u3044\u308d\u3093\u306a\u3068\u3053\u308d\u304b\u3089\u98db\u3093\u3067\u884c\u304f\u3068\u3002<\/p>\n<p>\u5b9f\u969b\u306e\u3068\u3053\u308d\u3001\u95a2\u6570\u9014\u4e2d\u3067return\u6587\u304c\u5165\u308b\u66f8\u304d\u65b9\u3082\u3053\u306e\u624b\u306egoto\u306e\u4f7f\u3044\u65b9\u306b\u985e\u4f3c\u3059\u308b\u9762\u304c\u3042\u308b\u3002<\/p>\n<p>\u305f\u3060\u3001while\u30eb\u30fc\u30d7\u306e\u672b\u5c3e\u306b\u98db\u3070\u3059\u3068\u3044\u3046\u306e\u304c\u7d50\u69cb\u3042\u304f\u3069\u3044\u6c17\u304c\u3059\u308b\u3002<\/p>\n<hr>\n<p>\u6b21\u306bswitch\u6587\u306e\u4e2d\u3067\u4f7f\u308f\u308c\u305fgoto\u6587\u3002<\/p>\n<pre>switch(mode){<br>&nbsp;&nbsp; case MODE1:<br>&nbsp;&nbsp;&nbsp;&nbsp; exec1();<br>&nbsp;&nbsp;&nbsp;&nbsp; goto MODE1to3;<br>&nbsp;&nbsp; case MODE2:<br>&nbsp;&nbsp;&nbsp;&nbsp; exec2();<br>&nbsp;&nbsp;&nbsp;&nbsp; goto MODE1to3;<br>&nbsp;&nbsp; case MODE3:<br>&nbsp;&nbsp;&nbsp;&nbsp; exec3();\nMODE1to3:<br>&nbsp;&nbsp;&nbsp;&nbsp; exec4();<br>&nbsp;&nbsp;&nbsp;&nbsp; break;<br>   case MODE4:<br>     break;\n}\n<\/pre>\n<p>mode=MODE1,MODE2,MODE3\u3067\u5171\u901a\u7684\u306a\u51e6\u7406\u304c\u3042\u308b\u304b\u3089\u3068\u3001goto\u6587\u3092\u4f7f\u3063\u3066\u66f8\u3044\u3066\u3044\u308b\u3068\u3002<\/p>\n<p>switch\u6587\u81ea\u4f53\u304c\u30af\u30bb\u306e\u5f37\u3044\u69cb\u6587\u3060\u3068\u601d\u3046\u3093\u3060\u3051\u3069\u2026\u2026<\/p>\n<p>case\u3054\u3068\u306bbreak;\u3067\u7d42\u308f\u308b\u306e\u304c\u57fa\u672c\u3067\u306f\u3042\u308b\u3051\u3069\u3001\u8907\u6570\u30e9\u30d9\u30eb\u675f\u306d\u308b\u5834\u5408\u306f\u3001<\/p>\n<pre>switch(mode){<br>&nbsp;&nbsp; case MODE1:<br>&nbsp;&nbsp; case MODE1:<br>&nbsp;&nbsp; case MODE1:<br>&nbsp;&nbsp;&nbsp;&nbsp; exec4();<br>&nbsp;&nbsp;&nbsp;&nbsp; break;\n}<br><\/pre>\n<p>\u306e\u3088\u3046\u306a\u66f8\u304d\u65b9\u3092\u3059\u308b\u3053\u3068\u304c\u4e00\u822c\u7684\u306b\u8a8d\u3081\u3089\u308c\u3066\u3044\u308b\u3002<\/p>\n<p>\u305f\u3060\u3001\u3053\u306e\u81ea\u7531\u5ea6\u306e\u9ad8\u3055\u3092\u9006\u624b\u306b\u53d6\u3063\u3066\u304b\u3001\u5909\u306a\u66f8\u304d\u65b9\u3092\u3059\u308b\u4eba\u304c\u3044\u308b\u3068\u3002<\/p>\n<p>\u6c17\u6301\u3061\u306f\u308f\u304b\u308b\u3051\u3069\u3001\u305d\u3093\u306a\u5909\u5247\u7684\u306a\u66f8\u304d\u65b9\u3092\u3059\u308b\u306e\u306f\u3044\u304b\u3093\u3060\u308d\u3046\u3068\u3002<\/p>\n<hr>\n<p>\u5f8c\u308d\u306b\u98db\u3076\u306e\u3067\u306f\u306a\u304f\u524d\u306b\u98db\u3076\u30d1\u30bf\u30fc\u30f3\u3082\u3042\u3063\u305f\u3002<\/p>\n<pre>POWERON:<br>&nbsp;&nbsp; exec1();<br>&nbsp;&nbsp; if(status==POWERON){<br>&nbsp;&nbsp;&nbsp;&nbsp; goto POWERON;<br>&nbsp;&nbsp; }<br>&nbsp;&nbsp; exec2();<br>&nbsp;&nbsp; if(status==POWERON){<br>&nbsp;&nbsp;&nbsp;&nbsp; goto POWERON;<br>&nbsp;&nbsp; }<br>&nbsp;&nbsp; while(1){<br>&nbsp;&nbsp;&nbsp;&nbsp; exec3();<br>&nbsp;&nbsp;&nbsp;&nbsp; if(status==POWERON){<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; goto POWERON;<br>&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp; }\n<\/pre>\n<p>\u30d5\u30e9\u30b0\u3092\u691c\u51fa\u3057\u305f\u3089\u521d\u671f\u5316\u51e6\u7406\u306b\u623b\u308b\u3063\u3066\u611f\u3058\u306e\u8a71\u3002<\/p>\n<p>\u95a2\u6570\u306e\u5916\u3067\u306a\u3093\u304b\u51e6\u7406\u3059\u308b\u65b9\u6cd5\u3092\u8003\u3048\u308b\u3079\u304d\u3060\u3068\u601d\u3046\u306e\u3060\u304c\u2026\u2026<\/p>\n<hr>\n<p>\u305d\u3057\u3066\u554f\u984c\u306f\u3053\u306e\u95a2\u6570\u3068\u3044\u3046\u306e\u304c1000\u884c\u3092\u8d85\u3048\u308b\u3088\u3046\u306a\u5de8\u5927\u306a\u3082\u306e\u3067\u3042\u308b\u3053\u3068\u3002<\/p>\n<p>\u3068\u3044\u3046\u308f\u3051\u3067\u89e3\u6790\u30c4\u30fc\u30eb\u3067\u30d5\u30ed\u30fc\u30c1\u30e3\u30fc\u30c8\u3092\u51fa\u529b\u3055\u305b\u3066\u3001<\/p>\n<p>\u305d\u306e\u30d5\u30ed\u30fc\u30c1\u30e3\u30fc\u30c8\u3092\u5927\u307e\u304b\u306b\u304f\u304f\u3063\u3066\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30d5\u30ed\u30fc\u3092\u793a\u3059\u56f3\u3092\u4f5c\u3063\u305f\u3002<\/p>\n<p>goto\u6587\u3092\u4f7f\u3063\u3066\u3044\u3066\u3082\u3001if\u6587\u3068else\u6587\u306e\u9593\u304c\u6570\u767e\u884c\u3068\u96e2\u308c\u3066\u3044\u3066\u3082\u3001<\/p>\n<p>\u5927\u307e\u304b\u306a\u30d5\u30ed\u30fc\u3068\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u884c\u6570\u3068\u306e\u95a2\u9023\u304c\u4ed8\u3051\u3070\u7406\u89e3\u306f\u3057\u3084\u3059\u304f\u306a\u308b\u3002<\/p>\n<hr>\n<p>\u3042\u308b\u7a0b\u5ea6\u306e\u307e\u3068\u307e\u308a\u3067\u95a2\u6570\u3068\u3057\u3066\u304f\u304f\u308a\u51fa\u3055\u308c\u3066\u3044\u308c\u3070\u3053\u3093\u306a\u3053\u3068\u306b\u306f\u2026\u2026<\/p>\n<p>\u305d\u308c\u306fswitch\u6587\u306e\u4e2d\u306egoto\u6587\u3092\u898b\u3066\u3082\u308f\u304b\u308b\u3051\u3069\u3001<\/p>\n<p>\u3042\u306e\u4f8b\u3060\u3063\u305f\u3089\u3053\u3046\u3044\u3046\u66f8\u304d\u65b9\u3067\u3082\u3044\u3044\u3093\u3067\u3059\u3088\u306d\u3002<\/p>\n<pre>switch(mode){<br>&nbsp;&nbsp; case MODE1:<br>&nbsp;&nbsp;&nbsp;&nbsp; exec1(); <br>&nbsp;&nbsp;&nbsp;&nbsp; exec4();<br>&nbsp;&nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp; case MODE2:<br>&nbsp;&nbsp;&nbsp;&nbsp; exec2();<br>&nbsp;&nbsp;&nbsp;&nbsp; exec4();<br>&nbsp;&nbsp;&nbsp;&nbsp; break;<br>&nbsp;&nbsp; case MODE3:<br>&nbsp;&nbsp;&nbsp;&nbsp; exec3();<br>&nbsp;&nbsp;&nbsp;&nbsp; exec4();<br>&nbsp;&nbsp;&nbsp;&nbsp; break;<\/pre>\n<p>\u554f\u984c\u306fexec4();\u306b\u3042\u305f\u308b\u90e8\u5206\u304c100\u884c\u3050\u3089\u3044\u3042\u308b\u3053\u3068\u3067\u3042\u308a\u3002<\/p>\n<hr>\n<p>\u4eca\u307e\u3067\u306e\u4ed5\u4e8b\u3067\u89e6\u3063\u3066\u3044\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u3061\u3083\u3093\u3068\u69cb\u9020\u5316\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3057\u3066\u305f\u306a\u3041\u3068\u3002<\/p>\n<p>\u30eb\u30fc\u30d7\u3067\u4f7f\u308f\u308c\u308bbreak\u6587\u3001continue\u6587\u3001\u3042\u308b\u3044\u306f\u30d7\u30ed\u30b0\u30e9\u30e0\u9014\u4e2d\u3067\u306ereturn\u6587\u306f\u53b3\u5bc6\u306b\u69cb\u9020\u5316\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3067\u306f\u306a\u3044\u306e\u3060\u3051\u3069\u3002<\/p>\n<p>\u305f\u3060\u3001\u3053\u308c\u3089\u306f\u3080\u3057\u308d\u7406\u89e3\u3057\u3084\u3059\u304f\u3059\u308b\u3082\u306e\u3068\u4e00\u822c\u7684\u306b\u306f\u7406\u89e3\u3055\u308c\u3066\u3044\u308b\u306e\u3060\u3057\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u3001\u4ed5\u4e8b\u3067\u3068\u3042\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u8aad\u3093\u3067\u3044\u305f\u306e\u3060\u304c\u3001 \u3069\u3046\u306b\u3082\u304a\u304b\u3057\u3044\u6c17\u304c\u3057\u305f\u306e\u3067\u8a73\u3057\u304f\u89e3\u6790\u3057\u3066\u3044\u305f\u3089\u3001\u306a\u3093\u3068goto\u6587\u304c\u4f7f\u308f\u308c\u3066\u3044\u305f\u3002 \u305d\u308c\u3082\u306a\u304b\u306a\u304b\u3042\u304f\u3069\u3044\u4f7f\u3044\u65b9\u3067\u3042\u308b\u3002 goto\u6587\u306b\u3064\u3044\u3066\u306f\u591a\u91cd\u30eb\u30fc\u30d7\u3092\u629c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-7980","post","type-post","status-publish","format-standard","hentry","category-computer"],"_links":{"self":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts\/7980","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7980"}],"version-history":[{"count":1,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts\/7980\/revisions"}],"predecessor-version":[{"id":7981,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts\/7980\/revisions\/7981"}],"wp:attachment":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7980"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7980"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7980"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}