{"id":386985,"date":"2024-06-29T07:02:54","date_gmt":"2024-06-29T07:02:54","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=386985"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-29T07:02:54","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=386985","title":{"rendered":"<span>60 \u0430\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 \u0434\u043b\u044f \u0421++ \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430, \u0447\u0430\u0441\u0442\u044c 2 (\u0441\u043e\u0432\u0435\u0442 6 \u2014 10)<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/457\/ad5\/eb8\/457ad5eb8f8e1ce3827982d55080a3d8.png\" alt=\"1053_60_cpp_antipatterns_ru\/image2.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/457\/ad5\/eb8\/457ad5eb8f8e1ce3827982d55080a3d8.png\"\/><\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0432\u0430\u043c\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0451\u043d\u043d\u0430\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u0432\u0440\u0435\u0434\u043d\u044b\u0445 \u0441\u043e\u0432\u0435\u0442\u043e\u0432 \u0434\u043b\u044f C++ \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0430\u0441\u044c \u0432 \u0446\u0435\u043b\u0443\u044e \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0443\u044e \u043a\u043d\u0438\u0433\u0443. \u0412\u0441\u0435\u0433\u043e \u0438\u0445 60, \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0435\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0435\u043c\u0443 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c. \u0412\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438 \u0432 \u0448\u0443\u0442\u043a\u0443, \u0438 \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u043e. \u041a\u0430\u043a \u0431\u044b \u0433\u043b\u0443\u043f\u043e \u043d\u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0441\u044f \u0432\u0440\u0435\u0434\u043d\u044b\u0439 \u0441\u043e\u0432\u0435\u0442, \u043e\u043d \u043d\u0435 \u0432\u044b\u0434\u0443\u043c\u0430\u043d, \u0430 \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. <\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u042f \u0431\u0443\u0434\u0443 \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0432\u0435\u0442\u044b \u043f\u043e 5 \u0448\u0442\u0443\u043a, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0443\u0442\u043e\u043c\u0438\u0442\u044c \u0432\u0430\u0441, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u0438\u043d\u0438-\u043a\u043d\u0438\u0433\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u043e\u0442\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438, \u0432\u0438\u0434\u0435\u043e \u0438 \u0442. \u0434. \u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435 \u0442\u0435\u0440\u043f\u0438\u0442\u0441\u044f, \u0437\u0434\u0435\u0441\u044c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0435\u0451 \u043f\u043e\u043b\u043d\u043e\u043c\u0443 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0443: &#171;<a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/1053\/\">60 \u0430\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 \u0434\u043b\u044f \u0421++ \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430<\/a>&#171;. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0436\u0435\u043b\u0430\u044e \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<h2 id=\"vrednyy-sovet-n6-nevidimye-simvoly\">\u0412\u0440\u0435\u0434\u043d\u044b\u0439 \u0441\u043e\u0432\u0435\u0442 N6. \u041d\u0435\u0432\u0438\u0434\u0438\u043c\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b<\/h2>\n<p>  <\/p>\n<p><strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043a\u043e\u0434\u0430 \u043d\u0435\u0432\u0438\u0434\u0438\u043c\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b. \u041f\u0443\u0441\u0442\u044c \u0432\u0430\u0448 \u043a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u042d\u0442\u043e \u043f\u0440\u0438\u043a\u043e\u043b\u044c\u043d\u043e.<\/strong><\/p>\n<p>  <\/p>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 Unicode-\u0441\u0438\u043c\u0432\u043e\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442 \u0432\u0438\u0434\u0438\u043c\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0432 \u0441\u0440\u0435\u0434\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u0438\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0431\u0443\u0434\u0443\u0442 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e. \u0422\u0430\u043a\u043e\u0439 \u0432\u0438\u0434 \u0430\u0442\u0430\u043a\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f Trojan Source.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/f08\/1a3\/35a\/f081a335a802a6721e35ac9b3dcdf0e2.png\" alt=\"1053_60_cpp_antipatterns_ru\/image4.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f08\/1a3\/35a\/f081a335a802a6721e35ac9b3dcdf0e2.png\"\/><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u043e\u0439 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 &#171;<a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/0933\/\">\u0410\u0442\u0430\u043a\u0430 Trojan Source \u0434\u043b\u044f \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u0434 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u043d\u0435\u0437\u0430\u043c\u0435\u0442\u043d\u044b\u0445 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430<\/a>&#171;. \u041d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0445\u043e\u0440\u0440\u043e\u0440-\u0447\u0442\u0438\u0432\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 :). \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e.<\/p>\n<p>  <\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u0431\u043e\u0440 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/0935\/\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio \u0443\u0436\u0435 <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v1076\/\">\u0443\u043c\u0435\u0435\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c<\/a> \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u0435\u0432\u0438\u0434\u0438\u043c\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b.<\/p>\n<p>  <\/p>\n<p><strong>\u0418 \u0437\u0430\u043e\u0434\u043d\u043e \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0432\u0440\u0435\u0434\u043d\u044b\u0439 \u0441\u043e\u0432\u0435\u0442.<\/strong> \u041c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0440\u043e\u0437\u044b\u0433\u0440\u044b\u0448\u0430 \u043d\u0430 1 \u0430\u043f\u0440\u0435\u043b\u044f. \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0433\u0440\u0435\u0447\u0435\u0441\u043a\u0438\u0439 \u0437\u043d\u0430\u043a \u0432\u043e\u043f\u0440\u043e\u0441\u0430 <a href=\"https:\/\/www.compart.com\/en\/unicode\/U+037E\">U+037E<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442, \u043a\u0430\u043a \u0442\u043e\u0447\u043a\u0430 \u0441 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 (;).<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/897\/5bf\/861\/8975bf861c3cce851659d180f2688574.png\" alt=\"1053_60_cpp_antipatterns_ru\/image5.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/897\/5bf\/861\/8975bf861c3cce851659d180f2688574.png\"\/><\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043a\u043e\u043b\u043b\u0435\u0433\u0430 \u043e\u0442\u0432\u043b\u0435\u0447\u0451\u0442\u0441\u044f, \u043f\u043e\u043c\u0435\u043d\u044f\u0439\u0442\u0435 \u0432 \u0435\u0433\u043e \u043a\u043e\u0434\u0435 \u043a\u0430\u043a\u0443\u044e-\u043d\u0438\u0431\u0443\u0434\u044c \u0442\u043e\u0447\u043a\u0443 \u0441 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0441\u0438\u043c\u0432\u043e\u043b. \u0418 \u0441\u0438\u0434\u0438\u0442\u0435, \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0439\u0442\u0435, \u043d\u0430\u0441\u043b\u0430\u0436\u0434\u0430\u0439\u0442\u0435\u0441\u044c :). <a href=\"https:\/\/godbolt.org\/z\/3jK39Yxo9\">\u041a\u043e\u0434 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f<\/a>, \u0445\u043e\u0442\u044f \u0432\u0440\u043e\u0434\u0435 \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/8e9\/89a\/d51\/8e989ad519ec1939ea1daaf9ed8bda4e.png\" alt=\"1053_60_cpp_antipatterns_ru\/image6.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/8e9\/89a\/d51\/8e989ad519ec1939ea1daaf9ed8bda4e.png\"\/><\/p>\n<p>  <\/p>\n<h2 id=\"vrednyy-sovet-n7-magicheskie-chisla\">\u0412\u0440\u0435\u0434\u043d\u044b\u0439 \u0441\u043e\u0432\u0435\u0442 N7. \u041c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0447\u0438\u0441\u043b\u0430<\/h2>\n<p>  <\/p>\n<p><strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430. \u0422\u0430\u043a \u0432\u0430\u0448\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0443\u043c\u043d\u0435\u0435 \u0438 \u0441\u043e\u043b\u0438\u0434\u043d\u0435\u0435. \u0421\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441\u043c\u043e\u0442\u0440\u044f\u0442\u0441\u044f \u0445\u0430\u0440\u0434\u043a\u043e\u0440\u043d\u043e: qw = ty \/ 65 \u2014 29 * s;<\/strong><\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u0430, \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0438\u0445 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9C%D0%B0%D0%B3%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%BE%D0%B5_%D1%87%D0%B8%D1%81%D0%BB%D0%BE_(%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5)\">\u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438<\/a>. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u0438\u0445 \u0447\u0438\u0441\u0435\u043b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043b\u043e\u0445\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c \u0434\u043b\u044f \u043a\u043e\u043b\u043b\u0435\u0433 \u0434\u0430 \u0438 \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u0440\u0430 \u043f\u043e \u043f\u0440\u043e\u0448\u0435\u0441\u0442\u0432\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u0447\u0438\u0441\u0435\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u044d\u0442\u043e \u043d\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043a\u0430\u043a-\u0442\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0430. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0435\u0441\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a 0 \u0438\u043b\u0438 1, \u0441\u0443\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0430. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0433\u0434\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u043c\u043e\u0433\u0443\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u0442\u0440\u0430\u0434\u0430\u0442\u044c \u043e\u0442 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0434\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0435. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438, \u043f\u043e\u044f\u0441\u043d\u044f\u044e\u0449\u0438\u0435 \u0444\u043e\u0440\u043c\u0443\u043b\u044b.<\/p>\n<p>  <\/p>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432 \u043e\u0434\u043d\u043e\u0439 \u0433\u043b\u0430\u0432\u0435 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0445 \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u043a\u043e\u0434. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f \u043a \u0442\u0430\u043a\u043e\u043c\u0443 \u043e\u0431\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0442\u0440\u0443\u0434\u0443, \u043a\u0430\u043a &#171;\u0421\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434&#187; \u0421. \u041c\u0430\u043a\u043a\u043e\u043d\u043d\u0435\u043b\u043b\u0430 (ISBN 978-5-7502-0064-1).<\/p>\n<p>  <\/p>\n<p>\u041f\u043b\u044e\u0441 \u0435\u0441\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u0430\u044f \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u044f \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 Stack Overflow: <a href=\"https:\/\/stackoverflow.com\/questions\/47882\/what-is-a-magic-number-and-why-is-it-bad\">What is a magic number, and why is it bad?<\/a><\/p>\n<p>  <\/p>\n<h2 id=\"vrednyy-sovet-n8-vezde-int\">\u0412\u0440\u0435\u0434\u043d\u044b\u0439 \u0441\u043e\u0432\u0435\u0442 N8. \u0412\u0435\u0437\u0434\u0435 int<\/h2>\n<p>  <\/p>\n<p><strong>\u0412\u043e \u0432\u0441\u0435\u0445 \u0441\u0442\u0430\u0440\u044b\u0445 \u043a\u043d\u0438\u0433\u0430\u0445 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0438 \u0434\u043b\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0446\u0438\u043a\u043b\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u0430 int. \u0422\u0430\u043a \u0438 \u0434\u0435\u043b\u0430\u0439\u0442\u0435. \u041d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043d\u0430\u0440\u0443\u0448\u0430\u0442\u044c \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u0438.<\/strong><\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445, \u0433\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u044f\u0437\u044b\u043a C++, \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0435 \u043c\u043e\u0433 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 <em><a href=\"https:\/\/en.cppreference.com\/w\/c\/types\/limits\">INT_MAX<\/a><\/em> \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 32-\u0431\u0438\u0442\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043d\u0430 Windows \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c 2 GB \u043f\u0430\u043c\u044f\u0442\u0438 (\u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0435\u0449\u0451 \u043c\u0435\u043d\u044c\u0448\u0435). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 32-\u0431\u0438\u0442\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 <em>int<\/em> \u0431\u044b\u043b\u043e \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0438\u043b\u0438 \u0434\u043b\u044f \u0438\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u043d\u044c\u0448\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u0438 \u0430\u0432\u0442\u043e\u0440\u044b \u043a\u043d\u0438\u0433 \u043d\u0435 \u0437\u0430\u043c\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u2014 \u0441\u043c\u0435\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0432 \u0446\u0438\u043a\u043b\u0430\u0445 \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0438 \u0442\u0438\u043f\u0430 <em>int<\/em>. \u0418 \u0432\u0441\u0451 \u0431\u044b\u043b\u043e \u0445\u043e\u0440\u043e\u0448\u043e.<\/p>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0440\u0430\u0437\u043c\u0435\u0440 \u0442\u0430\u043a\u0438\u0445 \u0442\u0438\u043f\u043e\u0432, \u043a\u0430\u043a <em>int<\/em>, <em>unsigned<\/em> \u0438 \u0434\u0430\u0436\u0435 <em>long<\/em>, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u0435\u043d. \u0412 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 Linux-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0443\u0434\u0438\u0432\u0438\u0442\u044c\u0441\u044f: \u043f\u043e\u0447\u0435\u043c\u0443 <em>long<\/em> \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e? \u0410 \u0434\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 MSVC \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b Windows x64 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/terms\/0012\/\">\u043c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445<\/a> <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/terms\/0026\/\">LLP64<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0442\u0438\u043f <em>long<\/em> \u043e\u0441\u0442\u0430\u043b\u0441\u044f 32-\u0431\u0438\u0442\u043d\u044b\u043c.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/975\/097\/61b\/97509761be0680391cfd0f5e2040e266.png\" alt=\"1053_60_cpp_antipatterns_ru\/image8.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/975\/097\/61b\/97509761be0680391cfd0f5e2040e266.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0410 \u043a\u0430\u043a\u0438\u0435 \u0436\u0435 \u0442\u043e\u0433\u0434\u0430 \u0442\u0438\u043f\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c? \u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0438\u043b\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/terms\/0030\/\">memsize-\u0442\u0438\u043f\u044b<\/a>, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <em>ptrdiff_t<\/em>, <em>size_t<\/em>, <em>intptr_t<\/em>, <em>uintptr_t<\/em>.<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 32-\u0431\u0438\u0442\u043d\u043e\u0433\u043e \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u043e\u0448\u0438\u0431\u043a\u0435 \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 64-\u0431\u0438\u0442\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">std::vector&lt;char> &amp;bigArray = get(); size_t n = bigArray.size(); for (int i = 0; i &lt; n; i++)   bigArray[i] = 0;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0431\u043e\u043b\u0435\u0435 <em>INT_MAX<\/em> \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>int<\/em>, \u0430 \u044d\u0442\u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u041f\u0440\u0438\u0447\u0451\u043c, \u043a\u0430\u043a \u043e\u043d\u043e \u0441\u0435\u0431\u044f \u043f\u0440\u043e\u044f\u0432\u0438\u0442, \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e, \u043a\u0430\u043a \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f. \u0412\u043e\u0442 \u0437\u0434\u0435\u0441\u044c \u044f \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b \u043e\u0434\u0438\u043d \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439: &#171;<a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/0374\/\">Undefined behavior \u0431\u043b\u0438\u0436\u0435, \u0447\u0435\u043c \u0432\u044b \u0434\u0443\u043c\u0430\u0435\u0442\u0435<\/a>&#171;.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">size_t n = bigArray.size(); for (size_t i = 0; i &lt; n; i++)   bigArray[i] = 0;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0449\u0451 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">std::vector&lt;char>::size_type n = bigArray.size(); for (std::vector&lt;char>::size_type i = 0; i &lt; n; i++)   bigArray[i] = 0;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u0435\u043d, \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u043b\u0438\u043d\u043d\u043e\u0432\u0430\u0442. \u0418 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0441\u043e\u0431\u043b\u0430\u0437\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u044b\u0432\u043e\u0434 \u0442\u0438\u043f\u0430. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0442\u043e\u0433\u0434\u0430 \u043e\u043f\u044f\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">auto n = bigArray.size(); for (auto i = 0; i &lt; n; i++)    \/\/ :-(   bigArray[i] = 0;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>n<\/em> \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f, \u0430 \u0432\u043e\u0442 \u0441\u0447\u0451\u0442\u0447\u0438\u043a <em>i<\/em> \u2013 \u043d\u0435\u0442. \u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 0 \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f <em>int<\/em>, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>i<\/em> \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0442\u0438\u043f <em>int.<\/em> \u0418 \u043c\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u0442\u043e\u043c\u0443, \u0441 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0438.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0436\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u043a\u043e\u0434? \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">for (auto it = bigArray.begin(); it != bigArray.end(); ++it)   *it = 0;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/language\/range-for\">range-based for loop<\/a>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">for (auto &amp;a : bigArray)   a = 0;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0427\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u0441\u0451 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043d\u043e \u043d\u0435\u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u043e \u043a \u0435\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u043c. \u0412\u0441\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u0435\u0433\u043e \u043a\u043e\u0434\u0435, \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 <em>int<\/em> \u0438 <em>unsigned<\/em>. \u0420\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435 \u043d\u0435\u0432\u0435\u0440\u043d\u043e \u043f\u043e \u0434\u0432\u0443\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u0430. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043e\u043f\u0430\u0441\u0435\u043d \u0434\u043b\u044f \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e. \u0422\u043e, \u0447\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438, \u043d\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0442\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0435\u0433\u0434\u0430. \u0415\u0449\u0451 \u043e\u0434\u0438\u043d \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u2014 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u043d \u0432 \u0434\u0440\u0443\u0433\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0433\u0434\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u2013 \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0434\u0435\u043b\u043e. \u0412 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u043d\u0446\u043e\u0432, \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043f\u0440\u0438\u0447\u0438\u043d \u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0440\u0430\u043a\u0435\u0442\u044b Ariane 5 \u0441\u0442\u0430\u043b\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043d\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430 \u043d\u043e\u0432\u044b\u0435 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b &#171;\u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438&#187;. \u0421\u043c. \u0441\u0442\u0430\u0442\u044c\u044e &#171;<a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/0426\/\">\u041a\u043e\u0441\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430: 370.000.000 $ \u0437\u0430 Integer overflow<\/a>&#171;.<\/p>\n<p>  <\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u0430. \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u043c\u0435\u0448\u0430\u043d\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0440\u0430\u0431\u043e\u0442\u0430\u044f \u0434\u0430\u0436\u0435 \u0441 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u0432 32-\u0431\u0438\u0442\u043d\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u0438 \u043d\u0435\u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u0432 64-\u0431\u0438\u0442\u043d\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">int A = -2; unsigned B = 1; int array[5] = { 1, 2, 3, 4, 5 }; int *ptr = array + 3; ptr = ptr + (A + B);   \/\/ Invalid pointer value on 64-bit platform printf(\"%i\\n\", *ptr);  \/\/ Access violation on 64-bit platform<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0441\u043b\u0435\u0434\u0438\u043c, \u043a\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f <em>ptr + (A + B)<\/em>:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c \u044f\u0437\u044b\u043a\u0430 C++, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>A<\/em> \u0442\u0438\u043f\u0430 <em>int<\/em> \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0442\u0438\u043f\u0443 <em>unsigned;<\/em><\/li>\n<li>\u041f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 <em>A<\/em> \u0438 <em>B<\/em>. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>0xFFFFFFFF<\/em> \u0442\u0438\u043f\u0430 <em>unsigned;<\/em><\/li>\n<li>\u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <em>ptr + 0xFFFFFFFFu<\/em>.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0439\u0434\u0435\u0442, \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435. \u0415\u0441\u043b\u0438 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0432 32-\u0431\u0438\u0442\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435, \u0442\u043e \u0434\u0430\u043d\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e <em>ptr \u2014 1<\/em>, \u0438 \u043c\u044b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u043c \u0447\u0438\u0441\u043b\u043e &#171;3&#187;. \u0412 64-\u0431\u0438\u0442\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043a \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044e \u0447\u0435\u0441\u0442\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>0xFFFFFFFFu<\/em>. \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0434\u0430\u043b\u0435\u043a\u043e \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0438 \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u043f\u043e \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044e \u043d\u0430\u0441 \u0436\u0434\u0443\u0442 \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u0441 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0430 \u044d\u0442\u0430 \u0442\u0435\u043c\u0430 \u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043b\u0443\u0447\u0448\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043d\u0435\u0439, \u0442\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b:<\/p>\n<p>  <\/p>\n<ol>\n<li>64-\u0431\u0438\u0442\u043d\u044b\u0435 \u0443\u0440\u043e\u043a\u0438. \u0423\u0440\u043e\u043a 13. <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/lessons\/0013\/\">\u041f\u0430\u0442\u0442\u0435\u0440\u043d 5. \u0410\u0434\u0440\u0435\u0441\u043d\u0430\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430<\/a>;<\/li>\n<li>64-\u0431\u0438\u0442\u043d\u044b\u0435 \u0443\u0440\u043e\u043a\u0438. \u0423\u0440\u043e\u043a 17. <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/lessons\/0017\/\">\u041f\u0430\u0442\u0442\u0435\u0440\u043d 9. \u0421\u043c\u0435\u0448\u0430\u043d\u043d\u0430\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430<\/a>;<\/li>\n<li><a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/a0050\/\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 size_t \u0438 ptrdiff_t<\/a>.<\/li>\n<\/ol>\n<p>  <\/p>\n<h2 id=\"vrednyy-sovet-n9-globalnye-peremennye\">\u0412\u0440\u0435\u0434\u043d\u044b\u0439 \u0441\u043e\u0432\u0435\u0442 N9. \u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435<\/h2>\n<p>  <\/p>\n<p><strong>\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b, \u0442. \u043a. \u043a \u043d\u0438\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043e\u0442\u043e\u0432\u0441\u044e\u0434\u0443.<\/strong><\/p>\n<p>  <\/p>\n<p>\u0418\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043e\u0442\u043e\u0432\u0441\u044e\u0434\u0443, \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043e\u0442\u043a\u0443\u0434\u0430 \u0438 \u043a\u043e\u0433\u0434\u0430 \u043a \u043d\u0438\u043c \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u043e\u0439, \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0432\u043e\u0446\u0438\u0440\u0443\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u0438\u0441\u043a\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0442\u043b\u0430\u0434\u043a\u0438. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0435 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0440\u0430\u0437\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439.<\/p>\n<p>  <\/p>\n<p>\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043d\u0435 \u0432 \u0441\u0447\u0451\u0442. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043e\u043d\u0438 \u043d\u0438\u043a\u0430\u043a\u0438\u0435 \u043d\u0435 &#171;\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435&#187;, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b :).<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438\u0437-\u0437\u0430 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u043b\u0433\u043e, \u0438 \u044d\u0442\u043e \u0443\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f\u0445 \u0438 \u043a\u043d\u0438\u0433\u0430\u0445. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043f\u043e \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435:<\/p>\n<p>  <\/p>\n<ol>\n<li>Stack Overflow. <a href=\"https:\/\/stackoverflow.com\/questions\/484635\/what-are-the-pros-and-cons-in-use-of-global-variables\">Are global variables bad?<\/a><\/li>\n<li><a href=\"http:\/\/wiki.c2.com\/?GlobalVariablesAreBad\">Global Variables Are Bad<\/a>.<\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/companies\/vk\/articles\/454946\/\">\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f: \u0437\u0430\u0447\u0435\u043c \u0438 \u043a\u0430\u043a \u0438\u0445 \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c<\/a>.<\/li>\n<li><a href=\"https:\/\/www.learncpp.com\/cpp-tutorial\/why-non-const-global-variables-are-evil\/\">Why (non-const) global variables are evil<\/a>.<\/li>\n<li><a href=\"https:\/\/embeddedartistry.com\/fieldatlas\/the-problems-with-global-variables\/\">The Problems with Global Variables<\/a>.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041d\u0443 \u0438 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0432\u0441\u0451 \u044d\u0442\u043e \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u0442\u0430\u0442\u044c\u0451\u0439 &#171;<a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/0439\/\">Toyota: 81 514 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0439 \u0432 \u043a\u043e\u0434\u0435<\/a>&#171;. \u041e\u0434\u043d\u0430 \u0438\u0437 \u043f\u0440\u0438\u0447\u0438\u043d, \u0447\u0442\u043e \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u044b\u043c \u0438 \u0437\u0430\u0431\u0430\u0433\u043e\u0432\u0430\u043d\u043d\u044b\u043c, \u2014 \u044d\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 9000 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<h2 id=\"vrednyy-sovet-n10-abort-v-bibliotekah\">\u0412\u0440\u0435\u0434\u043d\u044b\u0439 \u0441\u043e\u0432\u0435\u0442 N10. abort \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445<\/h2>\n<p>  <\/p>\n<p><strong>\u0421\u043e\u0432\u0435\u0442 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a: \u0432 \u043b\u044e\u0431\u043e\u0439 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e abort \u0438\u043b\u0438 terminate.<\/strong><\/p>\n<p>  <\/p>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043e\u0448\u0438\u0431\u043e\u043a: \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0427\u0443\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b \u0438\u043b\u0438 \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c, \u043a\u0430\u043a \u0442\u0443\u0442 \u0436\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <em><a href=\"https:\/\/en.cppreference.com\/w\/cpp\/utility\/program\/abort\">abort<\/a><\/em>, <em><a href=\"https:\/\/en.cppreference.com\/w\/cpp\/utility\/program\/exit\">exit<\/a><\/em> \u0438\u043b\u0438 <em><a href=\"https:\/\/en.cppreference.com\/w\/cpp\/error\/terminate\">terminate<\/a><\/em>. \u0414\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0443\u0442\u0438\u043b\u0438\u0442 \u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u044d\u0442\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u0414\u0430 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435, \u0430\u0432\u0442\u043e\u0440 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441\u0430\u043c \u0432\u043f\u0440\u0430\u0432\u0435 \u0440\u0435\u0448\u0438\u0442\u044c, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0431\u043e\u044f \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0435\u0441\u043b\u0438 \u0432\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u0447\u043d\u044b\u0439 \u043a\u043e\u0434. \u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0432 \u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u0447\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 \u043e\u0448\u0438\u0431\u043a\u0438 \/ \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u0410 \u0443\u0436\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 \u0440\u0435\u0448\u0430\u0442\u044c, \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u0448\u0430\u044f \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u0432 \u0432\u043e\u0441\u0442\u043e\u0440\u0433\u0435, \u0435\u0441\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u043a\u0438 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438, \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u0435 \u0434\u0430\u0432 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p>  <\/p>\n<p>\u0410 \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u0437\u0430\u0445\u043e\u0447\u0435\u0442 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f embedded-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a? \u0422\u0430\u043a\u0438\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u043a\u0430\u043a <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/0702\/\">MISRA<\/a> \u0438 AUTOSAR, \u0432\u043e\u043e\u0431\u0449\u0435 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u044e\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <em>abort<\/em> \u0438 <em>exit<\/em> (<a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v2509\/\">MISRA-C-21.8<\/a>, <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v2509\/\">MISRA-CPP-18.0.3<\/a>, <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v3506\/\">AUTOSAR-M18.0.3<\/a>). <\/p>\n<p>  <\/p>\n<h2 id=\"ob-etoy-mini-knige\">\u041e\u0431 \u044d\u0442\u043e\u0439 \u043c\u0438\u043d\u0438-\u043a\u043d\u0438\u0433\u0435<\/h2>\n<p>  <\/p>\n<p>\u0410\u0432\u0442\u043e\u0440: \u041a\u0430\u0440\u043f\u043e\u0432 \u0410\u043d\u0434\u0440\u0435\u0439 \u041d\u0438\u043a\u043e\u043b\u0430\u0435\u0432\u0438\u0447. E-Mail: karpov [@] viva64.com.<\/p>\n<p>  <\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 15 \u043b\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u043c\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043a\u043e\u0434\u0430 \u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f. \u0410\u0432\u0442\u043e\u0440 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0442\u0430\u0442\u0435\u0439, \u043f\u043e\u0441\u0432\u044f\u0449\u0451\u043d\u043d\u044b\u0445 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 C++. \u0421 2011 \u043f\u043e 2021 \u0433\u043e\u0434 \u0443\u0434\u043e\u0441\u0442\u0430\u0438\u0432\u0430\u043b\u0441\u044f \u043d\u0430\u0433\u0440\u0430\u0434\u044b Microsoft MVP \u0432 \u043d\u043e\u043c\u0438\u043d\u0430\u0446\u0438\u0438 Developer Technologies. \u041e\u0434\u0438\u043d \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 PVS-Studio. \u0414\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u044f\u0432\u043b\u044f\u043b\u0441\u044f CTO \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0421++ \u044f\u0434\u0440\u0430 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0434\u0435\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u2014 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438, \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u043e\u0432 \u0438 DevRel \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u0421\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043f\u043e\u043b\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442:<\/p>\n<p>  <\/p>\n<ul>\n<li>RU \u2014 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/1053\/\">60 \u0430\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 \u0434\u043b\u044f \u0421++ \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430<\/a><\/li>\n<li>EN \u2014 <a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/cpp\/1053\/\">60 terrible tips for a C++ developer<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/subscribe\/\">\u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c<\/a> \u043d\u0430 \u0435\u0436\u0435\u043c\u0435\u0441\u044f\u0447\u043d\u0443\u044e \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0430\u0432\u0442\u043e\u0440\u0430 \u0438 \u0435\u0433\u043e \u043a\u043e\u043b\u043b\u0435\u0433.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/740318\/\"> https:\/\/habr.com\/ru\/articles\/740318\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/457\/ad5\/eb8\/457ad5eb8f8e1ce3827982d55080a3d8.png\" alt=\"1053_60_cpp_antipatterns_ru\/image2.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/457\/ad5\/eb8\/457ad5eb8f8e1ce3827982d55080a3d8.png\"\/><\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0432\u0430\u043c\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0451\u043d\u043d\u0430\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u0432\u0440\u0435\u0434\u043d\u044b\u0445 \u0441\u043e\u0432\u0435\u0442\u043e\u0432 \u0434\u043b\u044f C++ \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0430\u0441\u044c \u0432 \u0446\u0435\u043b\u0443\u044e \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0443\u044e \u043a\u043d\u0438\u0433\u0443. \u0412\u0441\u0435\u0433\u043e \u0438\u0445 60, \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0435\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0435\u043c\u0443 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c. \u0412\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438 \u0432 \u0448\u0443\u0442\u043a\u0443, \u0438 \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u043e. \u041a\u0430\u043a \u0431\u044b \u0433\u043b\u0443\u043f\u043e \u043d\u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0441\u044f \u0432\u0440\u0435\u0434\u043d\u044b\u0439 \u0441\u043e\u0432\u0435\u0442, \u043e\u043d \u043d\u0435 \u0432\u044b\u0434\u0443\u043c\u0430\u043d, \u0430 \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-386985","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/386985","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=386985"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/386985\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=386985"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=386985"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=386985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}