{"id":402681,"date":"2024-06-29T16:39:48","date_gmt":"2024-06-29T16:39:48","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=402681"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=402681","title":{"rendered":"<span>\u041e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u0443\u0441\u0442\u0430\u0440\u0435\u043b\u0430: \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u043d\u044e\u0430\u043d\u0441\u043e\u0432 \u0432 \u043d\u043e\u0432\u044b\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430\u0445 C++<\/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\">Undefined behavior (UB) \u2014 \u0431\u043e\u043b\u044c, \u0437\u043d\u0430\u043a\u043e\u043c\u0430\u044f \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u0441\u043e \u0441\u0442\u0430\u0436\u0435\u043c; \u044d\u0434\u0430\u043a\u0438\u0439 \u00ab\u043a\u043e\u0434 \u0428\u0440\u0435\u0434\u0438\u043d\u0433\u0435\u0440\u0430\u00bb, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0437\u043d\u0430\u0435\u0448\u044c, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0442\u043e\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u043b\u0438 \u043d\u0435\u0442. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u044b \u044f\u0437\u044b\u043a\u0430 \u0421++20\/23\/26 \u043f\u0440\u0438\u0432\u043d\u0435\u0441\u043b\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u0435-\u0447\u0442\u043e \u043d\u043e\u0432\u043e\u0435. \u0418 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0432\u0430\u0436\u043d\u043e\u0435, \u0435\u0441\u043b\u0438 \u0432\u044b \u2014 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440 \u041f\u041e, \u0430 \u00ab\u043f\u043b\u044e\u0441\u044b\u00bb \u2014 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0441\u0442\u0435\u043a \u0432\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u0432 \u00ab\u041b\u0430\u0431\u043e\u0440\u0430\u0442\u043e\u0440\u0438\u0438 \u041a\u0430\u0441\u043f\u0435\u0440\u0441\u043a\u043e\u0433\u043e\u00bb \u043c\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0421++, \u0447\u0438\u0442\u0430\u0439\u0442\u0435 <a href=\"https:\/\/kas.pr\/habr_cpp_tutorial_dev\">\u0437\u0434\u0435\u0441\u044c<\/a>).<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0441\u043e \u0441\u0432\u043e\u0438\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 Senior Software Architect \u0438 Security Champion \u0432 <a href=\"https:\/\/kas.pr\/cpp_standart_kasperskyos\">\u043c\u0438\u043a\u0440\u043e\u044f\u0434\u0435\u0440\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 KasperskyOS<\/a> \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u043a\u0435\u0439\u0441\u044b-\u043b\u043e\u0432\u0443\u0448\u043a\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u043b\u044e\u0431\u043e\u043c \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u0432, \u0438 \u043f\u043e\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0421++20\/23\/26, \u2014 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f \u043b\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u0435\u0439\u0441\u043e\u0432 \u0441 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c, \u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043b\u0438 \u0421++ \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0435\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/eo\/cu\/sf\/eocusf3rf9zzy-aio6winoenigq.png\" data-src=\"https:\/\/habrastorage.org\/webt\/eo\/cu\/sf\/eocusf3rf9zzy-aio6winoenigq.png\"\/><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 undefined behavior<\/h2>\n<p>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439: \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 undefined behavior, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u0445 \u0432\u0441\u0435\u0433\u043e, \u0445\u043e\u0440\u043e\u0448\u043e \u044d\u0442\u043e \u0438\u043b\u0438 \u043f\u043b\u043e\u0445\u043e. \u0422\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0447\u0442\u043e \u043c\u0438\u0440 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u0432 \u00ab\u043f\u043b\u044e\u0441\u0430\u0445\u00bb \u0448\u0438\u0440\u043e\u043a \u0438 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0435\u043d.<\/p>\n<p>  \u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0435 \u0435\u0441\u0442\u044c \u0442\u0440\u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0441 undefined behavior.<\/p>\n<ol>\n<li>\u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c\u043e\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439, \u2014 implementation-defined behavior, \u0442. \u0435. \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0435. \u0421 \u043d\u0438\u043c \u0432\u0441\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0435\u0441\u0442\u044c \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 Index of implementation-defined behavior (<a href=\"https:\/\/timsong-cpp.github.io\/cppwp\/n4868\/impldefindex\">https:\/\/timsong-cpp.github.io\/cppwp\/n4868\/impldefindex<\/a>). \u0422\u0430\u043c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043a\u0435\u0439\u0441\u043e\u0432 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438:\n<ul>\n<li>\u0440\u0430\u0437\u043c\u0435\u0440 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u2014 \u043e\u043d \u0432\u0435\u0437\u0434\u0435 \u0440\u0430\u0437\u043d\u044b\u0439;<\/li>\n<li>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u043a\u0440\u043e\u0441\u0430 NULL;<\/li>\n<li>\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0441\u0442\u044c \u0442\u0438\u043f\u0430 char (\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0438\u043b\u0438 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u2014 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430);<\/li>\n<li>\u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u043a\u0440\u043e\u043c\u0435 char.<\/li>\n<li>\u2026<\/li>\n<\/ul>\n<p>  <\/li>\n<li>\u041d\u0435\u0443\u0442\u043e\u0447\u043d\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u2014 unspecified behavior, \u043a\u043e\u0433\u0434\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432. \u0412 \u0446\u0435\u043b\u043e\u043c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c implementation defined, \u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u043d\u0435 \u0434\u0430\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u043d\u0435\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f, \u043a\u0435\u0439\u0441\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0441\u043a\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u041f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043c\u043e\u0433\u0443\u0442 \u0441\u043b\u0443\u0436\u0438\u0442\u044c:\n<ul>\n<li>\u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (\u043a\u0440\u043e\u043c\u0435 \u0447\u0435\u0442\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u2014 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u00ab\u0438\u00bb, \u00ab\u0438\u043b\u0438\u00bb \u0438 \u0442\u0435\u0440\u043d\u0430\u0440\u043d\u043e\u0433\u043e);<\/li>\n<li>\u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 +, -, =, *, \/, \u043a\u0440\u043e\u043c\u0435 &amp;&amp;, ||, ?:;<\/li>\n<li>\u2026<\/li>\n<\/ul>\n<p>  <\/li>\n<li>\u041d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u2014 undefined behavior. \u0415\u0441\u043b\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0434\u0432\u0430 \u0442\u0438\u043f\u0430 \u0438\u0437\u043c\u0435\u043d\u0447\u0438\u0432\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442, \u0447\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u0441\u0435 \u0435\u0449\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0430, \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0435\u0442, \u0442\u043e \u0441 undefined behavior \u043e\u043d\u0430 \u0443\u0436\u0435 \u043d\u0435 \u0432\u0430\u043b\u0438\u0434\u043d\u0430\u044f. \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u043d\u0435 \u043d\u0430\u043b\u0430\u0433\u0430\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439, \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044f, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u043c\u043e\u0436\u0435\u0442 \u0432\u0441\u0435 \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e. \u0412 \u043d\u0435\u043c \u0434\u0430\u043d\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043e\u0431\u0449\u0435\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u044d\u0442\u043e\u0433\u043e undefined behavior \u0432\u0435\u0441\u044c\u043c\u0430 \u0448\u0438\u0440\u043e\u043a. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043a\u0430\u043a \u0440\u0430\u0437 \u043e\u0431 undefined behavior. \u041f\u0440\u0438\u043c\u0435\u0440\u044b:\n<ul>\n<li>\u0434\u043e\u0441\u0442\u0443\u043f \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430;<\/li>\n<li>\u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f;<\/li>\n<li>\u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u043d\u043e\u043b\u044c;<\/li>\n<li>\u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435;<\/li>\n<li>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u043e\u0441\u043b\u0435 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f;<\/li>\n<li>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439;<\/li>\n<li>\u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u0446\u0438\u043a\u043b\u044b \u0431\u0435\u0437 \u0441\u0430\u0439\u0434-\u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432;<\/li>\n<li>\u0433\u043e\u043d\u043a\u0438;<\/li>\n<li>\u2026<\/li>\n<\/ul>\n<p>  <\/li>\n<\/ol>\n<p>  <\/p>\n<h2>\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0441\u0435\u0433\u043e undefined behavior \u0432 \u0421++?<\/h2>\n<p>  \u041e\u0442\u0432\u0435\u0442 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0435\u0443\u0442\u0435\u0448\u0438\u0442\u0435\u043b\u0435\u043d \u2014 \u043d\u0438\u043a\u0442\u043e \u0442\u043e\u0447\u043d\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u0437\u044f\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 C99, \u0432 \u043d\u0435\u043c \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0438: J.2 Undefined behavior <a href=\"https:\/\/port70.net\/~nsz\/c\/c99\/n1256.html#J.2\">https:\/\/port70.net\/~nsz\/c\/c99\/n1256.html#J.2<\/a> (\u0442\u0430\u043c 193 \u043a\u0435\u0439\u0441\u0430). \u0412\u0441\u0435 \u044d\u0442\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0438 \u043a \u0421++.<\/p>\n<p>  \u041d\u043e \u0443 \u0421++ \u0435\u0441\u0442\u044c \u0438 \u0441\u0432\u043e\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0439 undefined behavior. \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0438:<\/p>\n<ul>\n<li>P1705R1 Enumerating Core Undefined Behavior (36 \u043a\u0435\u0439\u0441\u043e\u0432) <a href=\"https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2019\/p1705r1.html\">https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2019\/p1705r1.html<\/a> \u2014 \u044d\u0442\u043e\u0442 proposal \u0435\u0449\u0435 \u043d\u0435 \u043f\u0440\u0438\u043d\u044f\u0442, \u0442. \u0435. \u0440\u0430\u0431\u043e\u0442\u0430 \u043d\u0430\u0434 \u043d\u0438\u043c \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u0430. \u0415\u0433\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u043b\u044f \u0421++ \u0432\u0438\u0434\u044b undefined behavior \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u0445 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442;<\/li>\n<li>\u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0438\u043a\u0438 \u0440\u0430\u0437\u043d\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043f\u043e\u043b\u043d\u043e\u0442\u044b <a href=\"https:\/\/github.com\/Nekrolm\/ubbook\">https:\/\/github.com\/Nekrolm\/ubbook<\/a> (~60 \u043a\u0435\u0439\u0441\u043e\u0432). \u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e;<\/li>\n<li>\u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0432 \u0441\u0430\u043d\u0438\u0442\u0430\u0440\u0430\u0445: clang ubsan (~35 \u043f\u0440\u0430\u0432\u0438\u043b) <a href=\"https:\/\/clang.llvm.org\/docs\/UndefinedBehaviorSanitizer.html#id4\">https:\/\/clang.llvm.org\/docs\/UndefinedBehaviorSanitizer.html#id4<\/a> \u2014 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u0432\u043e\u043f\u0440\u043e\u0441\u0443.<\/li>\n<\/ul>\n<p>  \u041d\u043e \u0434\u0430\u0436\u0435 \u0432\u0441\u0435 \u044d\u0442\u0438 \u0441\u043f\u0438\u0441\u043a\u0438 \u0432\u043c\u0435\u0441\u0442\u0435 \u043d\u0435 \u0434\u0430\u0434\u0443\u0442 \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0447\u043d\u044f.<\/p>\n<h2>\u0410 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u0432\u0441\u0435 \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e?<\/h2>\n<p>  \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u0447\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c undefined behavior \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u0441\u0435 \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e. \u0422\u0430\u043a \u043b\u0438 \u044d\u0442\u043e? \u041e\u0442\u0432\u0435\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0442\u0435\u0448\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u2014 \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0430\u043a.<\/p>\n<p>  \u041e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u0442\u0438\u043f\u0430 \u0440\u0430\u0437\u043b\u0438\u0442\u043e\u0433\u043e \u043a\u043e\u0444\u0435 \u0438\u043b\u0438 \u0430\u0440\u043c\u0430\u0433\u0435\u0434\u0434\u043e\u043d\u0430. \u042f \u0436\u0435 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u043f\u043e\u0438\u0441\u043a\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u2014 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0441 undefined behavior \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0438\u0433\u0440\u0430\u0442\u044c \u0432 \u043b\u043e\u0442\u0435\u0440\u0435\u0435. <\/p>\n<p>  \u0421\u0430\u043c\u044b\u0439 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u043a\u0435\u0439\u0441 undefined behavior \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e, \u2014 \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u0430. \u0418\u043c \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0435\u0439\u0447\u0430\u0441 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043b\u043e\u0442\u0435\u0440\u0435\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0435. \u041d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u044c. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u0443\u0444\u0435\u0440\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u0447\u0442\u043e\u0431\u044b \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c shell-\u043a\u043e\u0434, \u0432\u043b\u0438\u044f\u044e\u0449\u0438\u0439 \u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440, \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: \u043c\u044b \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u0441\u0442\u0430\u043b\u0438 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u0435\u043c \u043b\u043e\u0442\u0435\u0440\u0435\u0438 \u0438 \u0432\u044b\u0438\u0433\u0440\u0430\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u00ab\u0410\u0410\u0410\u0410\u0410\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044c\u00bb! <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/fv\/2k\/2w\/fv2k2wpvk4zmzaev2wrwl6wsem4.png\" data-src=\"https:\/\/habrastorage.org\/webt\/fv\/2k\/2w\/fv2k2wpvk4zmzaev2wrwl6wsem4.png\"\/><\/p>\n<p>  \u041f\u043e \u0441\u0443\u0442\u0438, \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e undefined behavior \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u0435\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u0438 \u0431\u044b\u043b \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0441\u0445\u043e\u0434\u0430. \u0422\u0430\u043a\u0438\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e.<\/p>\n<h2>\u041f\u043e\u0447\u0435\u043c\u0443 UB \u2014 \u044d\u0442\u043e \u043f\u043b\u043e\u0445\u043e?<\/h2>\n<p>  <\/p>\n<h3>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c<\/h3>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u2014 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e. \u0427\u0442\u043e\u0431\u044b \u043e\u0446\u0435\u043d\u0438\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0438\u0437-\u0437\u0430 undefined behavior, \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c 25 TOP CWE (<a href=\"https:\/\/cwe.mitre.org\/top25\/archive\/2023\/2023_top25_list.html\">https:\/\/cwe.mitre.org\/top25\/archive\/2023\/2023_top25_list.html<\/a> \u2014 \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430 2023 \u0433\u043e\u0434) \u2014 \u0440\u0435\u0439\u0442\u0438\u043d\u0433 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0445 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043a \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044f\u043c. \u0412 \u0422\u041e\u041f\u0435 \u0437\u0430 2023 \u0433\u043e\u0434 \u0435\u0441\u0442\u044c \u043f\u044f\u0442\u044c \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 undefined behavior:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/jw\/3-\/nv\/jw3-nvtywyoa3dvbun6q1dnou3u.png\" data-src=\"https:\/\/habrastorage.org\/webt\/jw\/3-\/nv\/jw3-nvtywyoa3dvbun6q1dnou3u.png\"\/><\/p>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 out of bounds write \u2014 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u0430, \u043e\u043d\u043e \u0436\u0435 stack overflow. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u00ab\u043e\u0446\u0435\u043d\u043a\u0430\u00bb \u2014 \u044d\u0442\u043e \u043d\u0435\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0439\u0442\u0438\u043d\u0433, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0441\u0442\u0438 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438, \u0430 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u044c \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043a\u0441\u043f\u043b\u043e\u0439\u0442\u043e\u0432.<\/p>\n<p>  \u0412 \u0441\u043f\u0438\u0441\u043a\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 undefined behavior. \u041d\u043e \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044f\u0445 undefined behavior \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u043e\u0441\u0432\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439.  <\/p>\n<h3>\u041d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f<\/h3>\n<p>  \u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u2014 \u0441\u0438\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u0421++. \u041d\u043e \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u043f\u043e\u0434\u043d\u043e\u0441\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u044e\u0440\u043f\u0440\u0438\u0437\u044b. \u041c\u043d\u043e\u0433\u0438\u0435 \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0441\u043b\u044b\u0448\u0430\u043b\u0438, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438. \u0412\u043e\u0442 \u0445\u0440\u0435\u0441\u0442\u043e\u043c\u0430\u0442\u0438\u0439\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/f6\/dt\/dq\/f6dtdqphj2bo4qquicbbx-v4z1k.png\" data-src=\"https:\/\/habrastorage.org\/webt\/f6\/dt\/dq\/f6dtdqphj2bo4qquicbbx-v4z1k.png\"\/><\/p>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u0449\u0435\u0442 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442. \u041f\u043e\u0441\u043b\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c\u0441\u044f.<\/p>\n<p>  \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u0442 \u0446\u0438\u043a\u043b \u0438 if, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0432 \u043a\u043e\u0434\u0435 \u043e\u0448\u0438\u0431\u043a\u0430 \u2014 \u043c\u044b \u0432\u044b\u0445\u043e\u0434\u0438\u043c \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u0438\u0434\u0438\u0442 undefined behavior \u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u043e\u0433\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u0434 \u0442\u0430\u043a, \u043a\u0430\u043a \u0435\u043c\u0443 \u0443\u0434\u043e\u0431\u043d\u043e (\u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0430\u0441\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e). \u0417\u0434\u0435\u0441\u044c \u043e\u043d \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442, \u0447\u0442\u043e \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0435\u0439 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u0439\u0434\u0435\u043d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 true, \u0430 \u0446\u0438\u043a\u043b \u0441\u043e \u0432\u0441\u0435\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0437\u0430 \u0431\u043e\u0440\u0442. <\/p>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u043d\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f, \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0449\u0430\u044f \u0445\u043e\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0438. \u0412 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u0432 \u043a\u043e\u0434\u0435 \u043d\u0435\u0442 undefined behavior, \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e. <\/p>\n<p>  \u041a\u0435\u0439\u0441\u043e\u0432 \u0442\u0430\u043a\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e. \u0415\u0441\u0442\u044c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0445 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442:<\/p>\n<ul>\n<li>Contest: Craziest Compiler Output due to Undefined Behavior <a href=\"https:\/\/blog.regehr.org\/archives\/759\">https:\/\/blog.regehr.org\/archives\/759<\/a> <\/li>\n<li>Undefined Behavior: What Happened to My Code? <a href=\"https:\/\/cs.stanford.edu\/~zhihao\/papers\/apsys12.pdf\">https:\/\/cs.stanford.edu\/~zhihao\/papers\/apsys12.pdf<\/a> <\/li>\n<li>\u041d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u044f\u043c \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 <a href=\"https:\/\/habr.com\/ru\/companies\/otus\/articles\/594557\/\">https:\/\/habr.com\/ru\/companies\/otus\/articles\/594557\/<\/a> <\/li>\n<\/ul>\n<p>  <\/p>\n<h2>\u041f\u043e\u0447\u0435\u043c\u0443 UB \u2014 \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e?<\/h2>\n<p>  Undefined behavior \u2014 \u044d\u0442\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043b\u043e\u0445\u043e. \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u0435.   <\/p>\n<h3>\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c<\/h3>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435 \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u2014 \u044d\u0442\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u0442\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p>  \u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0421++ \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u043c\u043d\u044b\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c undefined behavior. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442: <\/p>\n<ul>\n<li>\u043d\u0443\u043b\u0435\u0432\u0443\u044e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e;<\/li>\n<li>\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 \u0441\u0441\u044b\u043b\u043e\u043a;<\/li>\n<li>\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0431\u0443\u0444\u0435\u0440\u0430;<\/li>\n<li>\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u0435\u0434\u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439.<\/li>\n<\/ul>\n<p>  \u0412\u0441\u0435 \u044d\u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u043d\u0438\u043c. \u0410 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0430\u0433\u0440\u0435\u0441\u0441\u0438\u0432\u043d\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0438\u043d\u043b\u0430\u0439\u043d\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u0442\u044c \u0446\u0438\u043a\u043b\u044b, \u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0431\u043e\u043b\u044c\u0448\u043e\u043c\u0443 \u0431\u0443\u0441\u0442\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/jp\/6p\/1d\/jp6p1dd4gb_hs_e9rql_b65fcqy.png\" data-src=\"https:\/\/habrastorage.org\/webt\/jp\/6p\/1d\/jp6p1dd4gb_hs_e9rql_b65fcqy.png\"\/><\/p>\n<h3>\u0420\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0435 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c<\/h3>\n<p>  \u041a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u0421 \u0438 \u0421++, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e\u043c \u0436\u0435\u043b\u0435\u0437\u0435. \u0418 \u0432\u0435\u0437\u0434\u0435 \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0440\u0430\u0437\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443, \u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u044e, \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043f\u0430\u043c\u044f\u0442\u044c\u044e, \u043e\u0442\u043b\u0438\u0447\u0438\u044f \u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0447\u0438\u0441\u0435\u043b \u0438 \u0442. \u043f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0435\u0431\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0434\u043b\u044f \u043c\u0430\u043d\u0435\u0432\u0440\u043e\u0432 \u0432 \u0432\u0438\u0434\u0435 undefined behaviour.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/il\/un\/v7\/ilunv7gw-3-k0ai3tlqa58tphji.png\" data-src=\"https:\/\/habrastorage.org\/webt\/il\/un\/v7\/ilunv7gw-3-k0ai3tlqa58tphji.png\"\/><\/p>\n<p>  \u0414\u0430, \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e, \u043d\u043e \u0435\u0441\u043b\u0438 UB \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0432\u0440\u0435\u0434\u0438\u0442\u044c, \u0442\u043e \u0432\u0441\u0435 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e\u0435 \u0442\u043e\u0433\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/eg\/bp\/ek\/egbpekte65m6aigsu1a2v9f8mfs.png\" data-src=\"https:\/\/habrastorage.org\/webt\/eg\/bp\/ek\/egbpekte65m6aigsu1a2v9f8mfs.png\"\/><\/p>\n<h2>UB \u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430\u0445<\/h2>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b undefined behaviour \u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430\u0445. \u0418 \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u0421++ 20. <\/p>\n<h3>\u0417\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0446\u0435\u043b\u044b\u0435 \u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u0432 \u0421++20<\/h3>\n<p>  \u0412 proposal P0907R4: Signed Integers are Two&#8217;s Complement <a href=\"https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2018\/p1236r1.html\">https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2018\/p1236r1.html<\/a> \u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u0434\u0435.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0430\u0440\u0430 \u0441\u043b\u043e\u0432 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434.<\/b>                         <\/p>\n<div class=\"spoiler_text\">\u0412 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u0440\u0435\u043c\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438: \u043f\u0440\u044f\u043c\u043e\u0439 \u043a\u043e\u0434, \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/fd\/ru\/sv\/fdrusvvl9s1peqe31k9tknpo5eu.png\" data-src=\"https:\/\/habrastorage.org\/webt\/fd\/ru\/sv\/fdrusvvl9s1peqe31k9tknpo5eu.png\"\/><\/p>\n<p>  \u041f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0432\u0435\u0437\u0434\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e: \u043f\u0435\u0440\u0432\u044b\u0439 \u0431\u0438\u0442 \u2014 \u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0439, \u0434\u043b\u044f \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043e\u043d \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u043e\u043b\u044c. \u0414\u043b\u044f \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0442\u043b\u0438\u0447\u0438\u044f \u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u0445. \u041e\u0431\u0449\u0435\u0435 \u0437\u0434\u0435\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0431\u0438\u0442 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u0438\u0446\u0435\u0439. \u0412 \u043f\u0440\u044f\u043c\u043e\u043c \u043a\u043e\u0434\u0435 \u0437\u043d\u0430\u0447\u0430\u0449\u0438\u0435 \u0431\u0438\u0442\u044b \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c\u0438, \u043a\u0430\u043a\u0438\u043c\u0438 \u0431\u044b\u043b\u0438, \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u2014 \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f, \u0430 \u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u043f\u043e\u043c\u0438\u043c\u043e \u0438\u043d\u0432\u0435\u0440\u0441\u0438\u0438 \u043a \u0447\u0438\u0441\u043b\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0434\u0438\u043d\u0438\u0447\u043a\u0430. \u0418\u043d\u0432\u0435\u0440\u0441\u0438\u044f \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u044f \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0410\u041b\u0423. \u0410 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u2014 \u044d\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0447\u0435\u0441\u0442\u044c \u0435\u0435 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0435.<\/p>\n<p>  \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u0440\u0435\u0448\u0430\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0434\u0432\u0443\u0445 \u043d\u0443\u043b\u0435\u0439 (\u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e), \u0442\u0438\u043f\u0438\u0447\u043d\u0443\u044e \u0434\u043b\u044f \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u2014 \u043e\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d. \u041f\u043b\u044e\u0441 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u044b \u2014 \u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u0434\u0435, \u0435\u0441\u043b\u0438 \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u0440\u043e \u0432\u043e\u0441\u044c\u043c\u0438\u0440\u0430\u0437\u0440\u044f\u0434\u043d\u0443\u044e \u0441\u0435\u0442\u043a\u0443, \u0435\u0441\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442: \u2212128. \u0412 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u0438 \u043f\u0440\u044f\u043c\u043e\u043c \u043a\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u043d\u0435\u0442.   <\/div>\n<\/p><\/div>\n<p>  \u0414\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 \u0421++20 \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u0438\u043c \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0433\u043e \u0446\u0435\u043b\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430. \u041e\u043d\u043e \u043c\u043e\u0433\u043b\u043e \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0432 \u043b\u044e\u0431\u043e\u043c \u043a\u043e\u0434\u0435, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0431\u044b\u043b\u043e undefined behavior. \u0410 \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 20-\u0433\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u0435\u0434\u0435\u0442 \u0441\u0435\u0431\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e: \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043e\u043d \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0442, \u0442. \u0435. \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c. <\/p>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0432 \u0421++ \u043d\u0435 \u0432\u0441\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e. \u0414\u0430\u0436\u0435 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430, \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f undefined behavior \u2014 \u0438 \u0432 proposal \u044d\u0442\u043e \u044f\u0432\u043d\u043e \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043e.<\/p>\n<blockquote><p>Note: Overflow for signed arithmetic yields undefined behavior (7.1 [expr.pre]). \u2014 end note<\/p><\/blockquote>\n<p>  \u0421 \u0442\u0435\u043c, \u0447\u0442\u043e \u044d\u0442\u043e undefined behavior, \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439 \u0432 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0435. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0432 \u0421++ \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0432 \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u0441\u0434\u0432\u0438\u0433\u0430\u0445 (&lt;&lt;, >>). \u041e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u044b \u0442\u0435\u043c, \u043a\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u0438\u0442\u043e\u0432\u044b\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438.<\/p>\n<ul>\n<li>\u041c\u043e\u0436\u043d\u043e \u0441\u0434\u0432\u0438\u0433\u0430\u0442\u044c \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 (\u0440\u0430\u043d\u044c\u0448\u0435 \u044d\u0442\u043e \u0431\u044b\u043b\u043e undefined behavior).\n<pre><code class=\"cpp\">int x = -1 &lt;&lt; 12;<\/code><\/pre>\n<\/li>\n<li>\u041f\u0440\u0438 \u0441\u0434\u0432\u0438\u0433\u0435 \u0432\u043b\u0435\u0432\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043d\u0443\u043b\u044f\u043c\u0438.<\/li>\n<li>\u041f\u0440\u0438 \u0441\u0434\u0432\u0438\u0433\u0435 \u0432\u043f\u0440\u0430\u0432\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u0431\u0438\u0442\u043e\u043c.<\/li>\n<li>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0434\u0432\u0438\u0433\u043e\u0432 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c.<\/li>\n<li>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0434\u0432\u0438\u0433\u043e\u0432 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0438\u0442\u043e\u0432 \u0447\u0438\u0441\u043b\u0430.<\/li>\n<\/ul>\n<p>  \u0423\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438 \u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u0434\u043b\u044f \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u0418\u0445 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 \u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u0432\u044b\u0437\u043e\u0432\u0435\u0442 undefined behavior.<\/p>\n<h3>\u0414\u0435\u043f\u0440\u0438\u043a\u0435\u0439\u0442 volatile \u0432 \u0421++20<\/h3>\n<p>  \u0412 \u0421++20 \u0437\u0430\u0434\u0435\u043f\u0440\u0438\u043a\u0435\u0439\u0442\u0438\u043b\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e volatile: P1152R4: Deprecating volatile <a href=\"https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2019\/p1152r4.html\">https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2019\/p1152r4.html<\/a>.<\/p>\n<p>  \u042d\u0442\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u0438\u043c\u0435\u0435\u0442 \u0434\u0443\u0440\u043d\u0443\u044e \u0441\u043b\u0430\u0432\u0443 \u0438 \u0432 \u0421, \u0438 \u0432 \u0421++. \u0420\u0430\u043d\u044c\u0448\u0435 \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u043b, \u043a\u0430\u043a \u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d\u043e \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0443\u0439\u0442\u0438. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ex\/9l\/jg\/ex9ljghjaf6rulhug00iaxgr7hm.png\" data-src=\"https:\/\/habrastorage.org\/webt\/ex\/9l\/jg\/ex9ljghjaf6rulhug00iaxgr7hm.png\"\/><\/p>\n<p>  \u041f\u0440\u0430\u0432\u0434\u0430, \u044d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0442\u0430\u043a\u2026<\/p>\n<blockquote><p>The proposed deprecation preserves the useful parts of volatile, and removes the dubious \/ already broken ones.<\/p><\/blockquote>\n<p>  \u0417\u0430\u043f\u0440\u0435\u0449\u0435\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u0435\u0439\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u0431\u044b\u043b\u0438 \u0441\u043b\u043e\u043c\u0430\u043d\u044b \u2014 \u043e\u043d\u0438 \u043b\u0438\u0431\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u043b\u0438 (\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c), \u043b\u0438\u0431\u043e \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 volatile, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 atomic. \u0412 \u0438\u0442\u043e\u0433\u0435 volatile \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f, \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e.<\/p>\n<p>  \u0417\u0430\u0434\u0435\u043f\u0440\u0438\u043a\u0435\u0439\u0442\u0438\u043b\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0435 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u0438 \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \/ \u0434\u0435\u043a\u0440\u0435\u043c\u0435\u043d\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. <\/p>\n<pre><code class=\"cpp\">volatile int x = 0;   x += 10; \/\/ C++ 20 deprecated x++; \/\/ C++ 20 deprecated<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u043f\u043e \u0441\u0442\u0430\u0440\u043e\u0439 \u043f\u0440\u0438\u0432\u044b\u0447\u043a\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b volatile \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 atomic, \u043e\u0436\u0438\u0434\u0430\u044f \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u0442\u043e \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u044b\u043b\u043e \u043d\u0435 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e. \u0410 \u0441\u0435\u0439\u0447\u0430\u0441 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u044f\u0432\u043d\u043e \u043f\u043e\u0434\u0441\u0432\u0435\u0447\u0435\u043d\u043e \u043f\u0440\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438.<\/p>\n<p>  \u0417\u0430\u043f\u0440\u0435\u0442\u0438\u043b\u0438 volatile \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. <\/p>\n<pre><code class=\"cpp\">volatile int func(volatile int arg); \/\/ C++ 20 deprecated<\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0437\u0430\u0434\u0430\u043d volatile \u0434\u043b\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430, \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u044b (\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u043b\u0441\u044f \u0431\u044b \u043d\u0435 \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440, \u0430 \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u0435\u043a, \u0438 \u044d\u0442\u043e \u0444\u043e\u0440\u0441\u0438\u043b\u043e\u0441\u044c \u0431\u044b \u0447\u0435\u0440\u0435\u0437 volatile). \u041d\u043e volatile \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043c\u0435\u043d\u044f\u043b calling conventions, \u0442. \u0435. \u0432 \u0438\u0442\u043e\u0433\u0435 \u043d\u0438 \u043d\u0430 \u0447\u0442\u043e \u043d\u0435 \u0432\u043b\u0438\u044f\u043b. \u0422\u0430\u043a\u0430\u044f \u0436\u0435 \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>  \u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d\u043d\u044b\u0439 \u043a\u0435\u0439\u0441 \u2014 \u044d\u0442\u043e volatile \u0432 structured buildings. \u042d\u0442\u043e \u043d\u0435\u043a\u0438\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u043e\u0432 \u0434\u043b\u044f \u0447\u043b\u0435\u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<pre><code class=\"cpp\">struct Foo {int val;} bar; volatile auto [val] = bar; \/\/ C++ 20 deprecated<\/code><\/pre>\n<p>  \u041d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0441 volatile, \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u043b\u0438\u044f\u043b \u043d\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0432\u043e\u0434\u0438\u043b \u0432 \u0437\u0430\u0431\u043b\u0443\u0436\u0434\u0435\u043d\u0438\u0435. \u0422. \u0435. \u043f\u043e \u0441\u0443\u0442\u0438 \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e.<\/p>\n<p>  \u041a\u0435\u0439\u0441\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 volatile \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f, \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438\u0448\u043b\u0438 \u0438\u0437 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043e\u043d \u0432\u0441\u0435\u0433\u0434\u0430 \u0448\u0435\u043b \u0432 \u043f\u0430\u0440\u0435 \u0441 const-\u043e\u043c. \u041d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0438, \u043f\u043e \u043c\u043e\u0435\u043c\u0443 \u043c\u043d\u0435\u043d\u0438\u044e, \u044d\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u043b\u044e\u0441.<\/p>\n<p>  \u0422\u0435\u043c, \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u044d\u0442\u0443 \u0442\u0435\u043c\u0443 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u0432\u044b\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u0441 CppCon 2019: Deprecating volatile \u2014 JF Bastien <a href=\"https:\/\/www.youtube.com\/watch?v=KJW_DLaVXIY&amp;ab_channel=CppCon\">https:\/\/www.youtube.com\/watch?v=KJW_DLaVXIY&amp;ab_channel=CppCon<\/a>.<\/p>\n<h3>\u0417\u043d\u0430\u043a\u043e\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f ssize() \u0432 \u0421++20<\/h3>\n<p>  \u0412 \u0421++20 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0437\u043d\u0430\u043a\u043e\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f ssize(): P1227: Signed ssize() functions <a href=\"https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2019\/p1227r2.html\">https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2019\/p1227r2.html<\/a>.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u0437\u0430\u0447\u0435\u043c \u043e\u043d\u0430 \u043d\u0443\u0436\u043d\u0430, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"cpp\">template &lt;typename> bool has_repeated_values(const T&amp; container) {   for (int i = 0; i &lt; container.size() - 1; ++i) {     if (container[i] == container[i + 1])       return true;   }   return false; }<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0437\u0430\u0434\u0430\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0449\u0435\u0442 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b. \u0421\u0443\u0434\u044f \u043f\u043e \u043a\u043e\u0434\u0443, \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0438\u0439\u0442\u0438 \u0443\u0436\u0435 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439. \u041d\u043e \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0430: \u0447\u0442\u0435\u043d\u0438\u0435 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430. \u0418 \u044d\u0442\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 undefined behavior \u2014 \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435, \u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0432\u0441\u0435\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0447\u0442\u043e.<\/p>\n<p>  \u0418\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u0435\u0439\u0441 \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 ssize(). \u041e\u043d\u0430 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0442\u0438\u043f std::size_t \u0432 \u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0442\u0438\u043f std::ptrdiff_t. \u0415\u0441\u043b\u0438 size_t \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0430\u0434\u0440\u0435\u0441\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c \u0434\u043b\u044f 64-\u0431\u0438\u0442\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b (\u0438 \u044d\u0442\u043e 64 \u0431\u0438\u0442\u0430), \u0442\u043e ptrdiff_t \u043f\u043e \u0441\u0432\u043e\u0435\u0439 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u043f\u0430\u043c\u044f\u0442\u0438. \u042d\u0442\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438 \u0437\u0434\u0435\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u043e\u0434\u0438\u043d \u0431\u0438\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 (63 \u0437\u043d\u0430\u0447\u0430\u0449\u0438\u0445 \u0431\u0438\u0442\u0430, \u043e\u0434\u0438\u043d \u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0439). \u041f\u0440\u0430\u0432\u0434\u0430, \u0437\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c undefined behavior, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u043f\u0440\u0435\u0432\u044b\u0441\u0438\u043b PTRDIFF_MAX, \u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 SIZE_MAX.<\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u043f\u0430\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0441 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u0432\u0441\u0435\u0439 \u0430\u0434\u0440\u0435\u0441\u0443\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 64-\u0431\u0438\u0442\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u0438 \u0447\u0430\u0441\u0442\u043e. \u0414\u0430 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0432\u0440\u044f\u0434 \u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u043a\u0435\u0439\u0441 undefined behavior \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0435\u0434\u043a\u0438\u0439. \u0422. \u0435. \u0432 \u0446\u0435\u043b\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 ssize() \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043f\u043e\u0444\u0438\u043a\u0441\u0438\u0442. <\/p>\n<h3>\u041f\u043e\u0447\u0438\u043d\u043a\u0430 \u0440\u0435\u043d\u0436\u043e\u0432\u043e\u0433\u043e for \u0432 \u0421++23<\/h3>\n<p>  \u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0431\u043e\u043b\u0435\u0435 \u0441\u0432\u0435\u0436\u0438\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430\u043c. \u041e\u0434\u043d\u043e \u0438\u0437 \u043c\u043e\u0438\u0445 \u043b\u044e\u0431\u0438\u043c\u044b\u0445 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u2014 \u0432 C++23 \u043f\u043e\u0447\u0438\u043d\u0438\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0440\u0435\u043d\u0436\u043e\u0432\u043e\u0433\u043e for: P2644R1: Fix for Range-based for Loop <a href=\"https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2022\/p2718r0.html\">https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2022\/p2718r0.html<\/a>. \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u0421++11 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e.<\/p>\n<p>  \u041f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e \u043e\u0448\u0438\u0431\u043a\u0443 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0437\u0434\u0430\u043b\u0435\u043a\u0430.<br \/>  \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f GetVector, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0435\u043a\u0442\u043e\u0440 \u0441\u0442\u0440\u043e\u043a. <\/p>\n<pre><code class=\"cpp\">std::vector&lt;std::string> GetVector() {   return { \"str1\", \"str2\" }; }<\/code><\/pre>\n<p>  \u0412 \u0421++ \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u0440\u043e\u0434\u043b\u0438\u0442\u044c \u0436\u0438\u0437\u043d\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0441\u043a\u043e\u0443\u043f\u0430. \u041f\u0435\u0440\u0432\u044b\u0439 \u2014 \u044d\u0442\u043e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0436\u0438\u0432\u0435\u0442 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0441\u043a\u043e\u0443\u043f\u0430. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c str \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. <\/p>\n<pre><code class=\"cpp\">{   const auto&amp; val{ GetVector() };   std::cout &lt;&lt; val.front() &lt;&lt; std::endl;  \/\/ str1 }<\/code><\/pre>\n<p>  \u0412\u0442\u043e\u0440\u043e\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u2014 \u044d\u0442\u043e \u0430\u0432\u0442\u043e\u0441\u0441\u044b\u043b\u043a\u0430, \u043e\u043d\u0430 \u0436\u0435 \u0444\u043e\u0440\u0432\u0430\u0440\u0434 \u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0441, \u043e\u043d\u0430 \u0436\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0434\u043b\u0435\u0432\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0436\u0438\u0437\u043d\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<pre><code class=\"cpp\">{   auto&amp;&amp; val{ GetVector() };   std::cout &lt;&lt; val.front() &lt;&lt; std::endl;  \/\/ str1 }<\/code><\/pre>\n<p>  \u0420\u0435\u043d\u0436\u043e\u0432\u044b\u0439 \u0446\u0438\u043a\u043b for \u0442\u043e\u0436\u0435 \u0443\u043c\u0435\u0435\u0442 \u043f\u0440\u043e\u0434\u043b\u0435\u0432\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0436\u0438\u0437\u043d\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u0412 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0436\u0438\u0442\u044c \u0434\u043e \u043a\u043e\u043d\u0446\u0430 for.<\/p>\n<pre><code class=\"cpp\">for (auto&amp; val : GetVector()) {   std::cout &lt;&lt; val &lt;&lt; std::endl;  \/\/ str1 str2 }<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u0431\u0443\u0434\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u043e \u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430, \u043f\u043e\u043a\u0430 \u043c\u044b \u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0438\u043c \u043f\u0440\u043e\u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0443 \u0441\u0442\u0440\u043e\u043a, \u043d\u043e \u0435\u0449\u0435 \u0438 \u043f\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c \u0432 \u0441\u0442\u0440\u043e\u043a\u0435. <\/p>\n<pre><code class=\"cpp\">for (auto&amp; val : GetVector().front()) {   std::cout &lt;&lt; val &lt;&lt; std::endl;  }<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c undefined behavior. \u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0442\u043e\u0438\u0442 \u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e undefined behavior \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 GetVector \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0435\u043a\u0442\u043e\u0440 \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430. \u041d\u043e \u0437\u0434\u0435\u0441\u044c \u044f \u0445\u043e\u0442\u0435\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u043a\u0446\u0435\u043d\u0442 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u043c.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e \u0440\u0435\u043d\u0436\u043e\u0432\u044b\u0439 for \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u043f\u0440\u043e\u0434\u043b\u0435\u043d\u0438\u044f \u0436\u0438\u0437\u043d\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0442\u043e \u044d\u0442\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043d\u0435 \u043c\u043e\u043d\u043e\u043b\u0438\u0442\u043d\u0430. \u041e\u043d\u0430 \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 for:<\/p>\n<pre><code class=\"cpp\">auto&amp;&amp; rg = GetVector().front(); \/\/ !!! auto pos = rg.begin(); auto end = rg.end(); for ( ; pos != end; ++pos ) {   char c = *pos;   \u2026 }<\/code><\/pre>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f (\u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0438). \u041e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u0431\u044b \u043f\u0440\u043e\u0434\u043b\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0436\u0438\u0437\u043d\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043d\u043e, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0437\u0434\u0435\u0441\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u0432\u044b\u0437\u043e\u0432\u043e\u0432. \u0412 C++ \u043f\u0440\u043e\u0434\u043b\u0435\u043d\u0438\u0435 \u043f\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u043d\u0435 \u043e\u0442\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u043e \u043d\u0438\u043a\u043e\u0433\u0434\u0430. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0440\u0435\u043d\u0436\u043e\u0432\u044b\u0439 for \u0442\u043e\u0436\u0435 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/qd\/2b\/zb\/qd2bzbapctyutfg_kyvmittumik.png\" data-src=\"https:\/\/habrastorage.org\/webt\/qd\/2b\/zb\/qd2bzbapctyutfg_kyvmittumik.png\"\/><\/p>\n<p>  \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0440\u0435\u043d\u0436\u043e\u0432\u043e\u043c for, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0434\u0435\u0442\u0430\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430 \u2014 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 for \u2014 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043a\u0430\u043a \u043e\u043d \u0432\u043d\u0443\u0442\u0440\u0438 \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u0438 \u0432\u043e \u0447\u0442\u043e \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f. \u042d\u0442\u0430 \u0441\u043a\u0440\u044b\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u043c\u043d\u0435\u043d\u0438\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u0442\u043e, \u043a\u0430\u043a\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f, \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0442\u043e\u0433\u043e, \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u043e\u043d\u0438 \u0438\u043b\u0438 \u043d\u0435\u0442.<\/p>\n<p>  \u0412 proposal \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e, \u043a\u0430\u043a \u044d\u0442\u043e \u0444\u0438\u043a\u0441\u0438\u0442\u0441\u044f. \u0422\u0430\u043c \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u043a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u0438\u0435 \u043d\u0430 \u043b\u044f\u043c\u0431\u0434\u0443 \u0438 \u0432 \u043d\u0435\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442. \u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043b\u044f\u043c\u0431\u0434\u044b, \u0447\u0442\u043e \u0440\u0435\u0448\u0438\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443. \u041d\u043e \u044d\u0442\u043e \u043d\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431.<\/p>\n<p>  \u0412\u0430\u0436\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434: \u0432 \u0421++23 \u0432\u0441\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0432 \u0440\u0435\u043d\u0436\u043e\u0432\u043e\u043c for \u043f\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435 (\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b \u0438\u0445 \u0442\u0430\u043c \u043d\u0438 \u0431\u044b\u043b\u043e), \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c\u0441\u044f. \u042d\u0442\u043e \u043d\u0435\u0441\u043e\u043c\u043d\u0435\u043d\u043d\u044b\u0439 \u043f\u043b\u044e\u0441.<\/p>\n<h3>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 string \u0441 \u043d\u0443\u043b\u0435\u0432\u044b\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c \u0432 \u0421++23<\/h3>\n<p>  \u0421++23 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c string \u0441 \u043d\u0443\u043b\u0435\u0432\u044b\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c: P2166R1: A Proposal to Prohibit std::basic_string and std::basic_string_view construction from nullptr <a href=\"https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2020\/p2166r1.html\">https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2020\/p2166r1.html<\/a> <\/p>\n<p>  \u0412 \u0447\u0435\u043c \u0442\u0443\u0442 \u0441\u0443\u0442\u044c. \u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432 string \u0432 \u0421++ \u2014 \u0438\u0437 \u043d\u0443\u043b\u044c-\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438. \u0422\u0430\u043c \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043d\u0443\u043b\u044c-\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0439, \u0438\u043d\u0430\u0447\u0435 \u043f\u0440\u043e\u044f\u0432\u0438\u0442\u0441\u044f undefined behavior. <\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u0440\u043e nullptr, \u0442\u043e \u044d\u0442\u043e \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b. \u041f\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 \u0437\u0434\u0435\u0441\u044c \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c undefined behavior: <\/p>\n<pre><code class=\"cpp\">std::string str{ nullptr };<\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u043f\u043e\u0444\u0438\u043a\u0441\u0438\u0442\u044c, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0438 \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435: \u044f\u0432\u043d\u043e \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u043b\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0438\u0437 nullptr. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438, \u0442\u043e \u043d\u0435\u0442 undefined behavior. \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0432\u0441\u0435 \u043d\u0435\u043f\u043b\u043e\u0445\u043e. \u041d\u043e, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0435\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441 \u0442\u0435\u043c \u0436\u0435 nullptr, \u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0431\u0443\u0434\u0435\u0442 undefined behavior.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"cpp\">char *ch = nullptr; std::string str(ch); \/\/ UB<\/code><\/pre>\n<p>  \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441 nullptr \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u043e\u0432\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u043c\u043d\u043e\u0433\u0438\u0445 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430\u0445. \u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u043d\u0430 clang \u0431\u0443\u0434\u0435\u0442 \u044d\u043a\u0441\u0435\u043f\u0448\u0435\u043d. \u041d\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u044d\u0442\u043e \u0442\u0430\u043a. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u0430\u0439\u043a\u0440\u043e\u0441\u043e\u0444\u0442\u043e\u0432\u0441\u043a\u0438\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0441\u0435\u0431\u044f \u0432\u0435\u0434\u0435\u0442 \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u0443\u0447\u0448\u0435 \u043b\u043e\u0433\u0438\u043a\u0443 \u043d\u0430 \u044d\u0442\u043e \u043d\u0435 \u0437\u0430\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c.<\/p>\n<h2>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u043a\u0441\u043a\u043b\u044e\u0437\u0438\u0432\u043d\u043e\u0433\u043e \u0440\u0435\u0436\u0438\u043c\u0430 \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0442\u0440\u0438\u043c\u043e\u0432 \u0432 \u0421++23<\/h2>\n<p>  \u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043a\u0435\u0439\u0441 \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u043a\u0441\u043a\u043b\u044e\u0437\u0438\u0432\u043d\u043e\u0433\u043e \u0440\u0435\u0436\u0438\u043c\u0430 \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0442\u0440\u0438\u043c\u043e\u0432: P2467R1: Support exclusive mode for fstreams <a href=\"https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2022\/p2467r1.html\">https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2022\/p2467r1.html<\/a>. <\/p>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0435\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e, \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0411\u044b\u0432\u0430\u044e\u0442 \u043a\u0435\u0439\u0441\u044b, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432 \u0444\u0430\u0439\u043b\u0435 \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c \u0435\u0433\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0444\u0430\u0439\u043b\u0430. \u0424\u0430\u0439\u043b \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u043d\u0435\u0442:<\/p>\n<pre><code class=\"cpp\">void CheckAndCreate(const std::filesystem::path&amp; p) {   if (!std::filesystem::exists(p)) {       std::fstream f(p.string(), std::ios_base::in | std::ios_base::out);       f &lt;&lt; \"data\" &lt;&lt; std::endl;   } }<\/code><\/pre>\n<p>  \u042d\u0442\u043e \u043d\u0443\u0436\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432. \u0412\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0430, \u0438 \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u043d\u0435\u0442, \u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0444\u0430\u0439\u043b, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u0432 \u043d\u0435\u0433\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u0435\u0441\u043b\u0438 \u0436\u0435 \u043a\u043e\u043d\u0444\u0438\u0433 \u0435\u0441\u0442\u044c, \u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u0447\u0438\u0442\u0430\u0435\u0442).<\/p>\n<p>  \u041d\u043e \u0443 \u044d\u0442\u043e\u0433\u043e \u043a\u0435\u0439\u0441\u0430 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. \u041c\u0435\u0436\u0434\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0444\u0430\u0439\u043b\u0430 \u0438 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u043c \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0435\u0441\u0442\u044c \u043e\u043a\u043d\u043e \u0434\u043b\u044f \u0433\u043e\u043d\u043a\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u043a\u043b\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c symlink \u043d\u0430 \u043f\u0443\u0442\u044c \u043a \u043a\u0430\u043a\u043e\u043c\u0443-\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443, \u0430 \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b. \u0417\u0434\u0435\u0441\u044c, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043d\u043e\u0433\u043e \u00ab\u0435\u0441\u043b\u0438\u00bb, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u043c\u0435\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u0430\u0432\u0430. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u043c\u0435\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0432\u043e\u0434, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0442\u043e, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a\u0443. \u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u0437\u0432\u0435\u0437\u0434\u044b \u0441\u043e\u0439\u0434\u0443\u0442\u0441\u044f, \u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0430\u044f \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/lh\/_u\/se\/lh_usefjk3cwnnf7akbcwqzhzmg.png\" data-src=\"https:\/\/habrastorage.org\/webt\/lh\/_u\/se\/lh_usefjk3cwnnf7akbcwqzhzmg.png\"\/><\/p>\n<p>  \u0420\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0444\u043b\u0430\u0433\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0421++ \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f noreplace. \u041e\u043d \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0433\u043e \u0441\u0442\u0440\u0438\u043c\u0430 \u0438 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0444\u0430\u0439\u043b\u0430. \u0415\u0441\u043b\u0438 \u0444\u0430\u0439\u043b\u0430 \u043d\u0435\u0442, \u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c\u0441\u044f. <\/p>\n<p>  \u0414\u0430\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u0430, \u0438 \u044d\u0442\u043e\u0442 \u0444\u043b\u0430\u0433 \u2014 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u043d\u043e\u0432\u043e\u0441\u0442\u044c. \u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0435 \u0421 \u043e\u043d \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u0430\u0432\u043d\u043e. \u0422\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0435 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u0438 \u0432 \u0421++.<\/p>\n<pre><code class=\"cpp\">void CheckAndCreateNoRace(const std::filesystem::path&amp; p) {   std::fstream f(p.string(),     std::ios_base::in |     std::ios_base::out |     std::ios_base::noreplace);   f &lt;&lt; \"data\" &lt;&lt; std::endl; }<\/code><\/pre>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u044d\u0442\u043e \u0444\u0438\u043a\u0441\u0438\u0442 \u043d\u0435 \u0432\u0441\u0435 \u043a\u0435\u0439\u0441\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435, \u0430 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0444\u0430\u0439\u043b\u0430, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0435\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0438\u0441\u0438, \u044d\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u043f\u0443\u0442\u0438 \u0438 \u043d\u0435 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e, \u0442. \u0435. \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u043d\u043a\u0430. <\/p>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0437\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u043f\u043e\u0441\u043f\u043e\u0440\u0438\u0442\u044c, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u044d\u0442\u043e \u0433\u043e\u043d\u043a\u043e\u0439 \u0438\u043b\u0438 \u043d\u0435\u0442. \u0411\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0433\u043e\u043d\u043a\u043e\u0439. \u041d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043a\u0435\u0439\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u0447\u0442\u043e-\u0442\u043e \u043d\u0430 \u043f\u0443\u0442\u0438, \u0430 \u043f\u043e\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0444\u0430\u0439\u043b \u0443\u0436\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e, \u0432\u0441\u0435 \u043b\u043e\u043c\u0430\u043d\u044b\u0435. \u0412\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 std::filesystem \u0438\u043c\u0435\u0435\u0442 \u0442\u0430\u043a\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. <\/p>\n<pre><code class=\"cpp\">void CheckAndUse(const std::filesystem::path&amp; p) {     if (std::filesystem::is_regular_file(p)) {         std::fstream f(p.string(), std::ios_base::in | std::ios_base::out);         f &lt;&lt; \"data\";     } }<\/code><\/pre>\n<p>  \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0430\u0440\u0430 proposal, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0435\u0448\u0430\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0440\u0430\u0434\u0438\u043a\u0430\u043b\u044c\u043d\u043e \u2014 \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0443\u0442\u0438 \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0445\u044d\u043d\u0434\u043b\u044b. <\/p>\n<p>  \u0412 \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u043f\u043e\u0437\u0430\u043b\u0430\u0445 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0435\u0440\u0435\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 std::filesystem. \u041e\u043d\u0438 \u043d\u0430\u043c\u0435\u0447\u0435\u043d\u044b \u043d\u0430 \u0421++26, \u0442. \u0435. \u0435\u0449\u0435 \u043d\u0435 \u043f\u0440\u0438\u043d\u044f\u0442\u044b: <\/p>\n<ul>\n<li>P1030R6: std::filesystem::path_view <a href=\"https:\/\/wg21.link\/p1030\">https:\/\/wg21.link\/p1030<\/a>;<\/li>\n<li>P1883R2: file_handle and mapped_file_handle <a href=\"https:\/\/wg21.link\/p1883\">https:\/\/wg21.link\/p1883<\/a>.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u0414\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u043c \u0432 \u0421++26<\/h3>\n<p>  \u0412 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445 \u0421++ \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u044b\u043b\u043e \u0434\u0432\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u2014 \u0447\u0435\u0440\u0435\u0437 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0441\u043a\u043e\u0431\u043a\u0438 \u0438 \u043c\u0435\u0442\u043e\u0434 At. \u041f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d, \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b \u0438 \u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u043b \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u041e\u0431\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u0431\u044b\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0432\u043e \u0432\u0441\u0435\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445, \u043a\u0440\u043e\u043c\u0435 span. \u0421 \u0441\u0430\u043c\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f std::span \u0432 \u0421++20 \u043c\u0435\u0442\u043e\u0434\u0430 At \u0442\u0430\u043c \u043d\u0435 \u0431\u044b\u043b\u043e.<\/p>\n<p>  Proposal P2821R4: span.at() <a href=\"https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2023\/p2821r4.html\">https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2023\/p2821r4.html<\/a> \u0438\u043c\u0435\u0435\u0442 \u043c\u0430\u043b\u043e \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0435\u0439, \u043d\u043e \u0437\u0430\u0434\u0430\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432. \u041d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u043b\u0438 \u043d\u0438 \u0432 \u0421++20, \u043d\u0438 \u0432 \u0421++23 \u043d\u0435\u0442 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430? \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e, \u0442\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u0443\u0431\u0440\u0430\u043b\u0438 \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 (\u0438\u043b\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043d\u0435 \u0437\u0430\u0434\u0435\u043f\u0440\u0438\u043a\u0435\u0439\u0442\u0438\u043b\u0438)? \u041e\u0442\u0432\u0435\u0442 \u0434\u0430\u043d \u0442\u0430\u043c \u0436\u0435, \u0438 \u043e\u043d \u0431\u0430\u043d\u0430\u043b\u0435\u043d: <\/p>\n<blockquote><p>Ultimately, this becomes a stereotypical example of how C++ traditionally handles safety.<\/p><\/blockquote>\n<p>  \u042d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432 \u0421++ \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043a\u0435\u0439\u0441\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e. \u0412\u0441\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0435 \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u0432 \u0441\u0443\u043c\u0430\u0442\u043e\u0445\u0435. \u0418\u043d\u043e\u0433\u0434\u0430 \u043e \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u0445 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0431\u044b\u0442\u044c.<\/p>\n<p>  \u0422\u043e\u043b\u044c\u043a\u043e \u043b\u0438\u0448\u044c \u0432 \u0421++26 \u0432 span \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f at().<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ef\/1s\/d5\/ef1sd5sex-zkzr2rumujkhigpfs.png\" data-src=\"https:\/\/habrastorage.org\/webt\/ef\/1s\/d5\/ef1sd5sex-zkzr2rumujkhigpfs.png\"\/><\/p>\n<h3>\u0410\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u0441 \u043d\u0430\u0441\u044b\u0449\u0435\u043d\u0438\u0435\u043c \u0432 \u0421++26<\/h3>\n<p>  \u041d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u2014 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043a\u0435\u0439\u0441: \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u0441 \u043d\u0430\u0441\u044b\u0449\u0435\u043d\u0438\u0435\u043c: C++ 26, P0543R3: Saturation arithmetic <a href=\"https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2023\/p0543r3.html\">https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2023\/p0543r3.html<\/a>.<\/p>\n<p>  \u0410\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u0441 \u043d\u0430\u0441\u044b\u0449\u0435\u043d\u0438\u0435\u043c \u2014 \u044d\u0442\u043e \u0432\u0435\u0440\u0441\u0438\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u044b \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u043c \u043c\u0435\u0436\u0434\u0443 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/gd\/0z\/jg\/gd0zjgsdyxnfm-omv2vb--srqws.png\" data-src=\"https:\/\/habrastorage.org\/webt\/gd\/0z\/jg\/gd0zjgsdyxnfm-omv2vb--srqws.png\"\/><\/p>\n<p>  \u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0446\u0435\u043b\u044b\u0445 undefined behavior \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u043e\u043d\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u044b\u043b\u043e \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u043e\u043c \u0438\u043b\u0438 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u043e\u0439 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e. \u041f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0446\u0435\u043b\u044b\u0445 \u0432 \u0421++ \u0431\u044b\u043b\u043e undefined behavior. \u0410 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u0441 \u043d\u0430\u0441\u044b\u0449\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u0440\u0430\u0434\u0438\u043a\u0430\u043b\u044c\u043d\u043e. \u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0438 \u0441 \u043d\u0430\u0441\u044b\u0449\u0435\u043d\u0438\u0435\u043c \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0415\u0441\u043b\u0438 \u043c\u044b \u0432\u044b\u0445\u043e\u0434\u0438\u043c \u0437\u0430 \u044d\u0442\u043e\u0442 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u043b\u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e (\u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0432 \u043a\u0430\u043a\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043c\u044b \u0432\u044b\u0448\u043b\u0438 \u0437\u0430 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d). <\/p>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0438 \u0441 \u043d\u0430\u0441\u044b\u0449\u0435\u043d\u0438\u0435\u043c \u2014 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u043d\u043e\u0432\u043e\u0441\u0442\u044c. \u041e\u043d\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u0432\u0438\u0442\u0430 \u0438 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043a\u0435\u0439\u0441\u0430\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442. \u041e\u043d\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u0438\u043b\u0438 3D \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438. <\/p>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0438 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435. \u0412 \u0421++26 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u0447\u0435\u0442\u044b\u0440\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0442 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f, \u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f Saturate_cast \u2014 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a \u0442\u0438\u043f\u0443, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043b\u0438\u0431\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c, \u043b\u0438\u0431\u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c. <\/p>\n<pre><code class=\"cpp\">template&lt;class T> constexpr T add_sat(T x, T y) noexcept;  template&lt;class T> constexpr T sub_sat(T x, T y) noexcept;  template&lt;class T> constexpr T mul_sat(T x, T y) noexcept;  template&lt;class T> constexpr T div_sat(T x, T y) noexcept;  template&lt;class T, class U> constexpr T saturate_cast(U x) noexcept; <\/code><\/pre>\n<p>  \u041c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0412 \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 (if) \u0432\u043e \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u2014 \u043f\u043e \u0441\u0443\u0442\u0438 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041d\u043e, \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 proposal, \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0435 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u2014 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0441\u0442\u044c \u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u0445. <\/p>\n<blockquote><p>Most modern hardware architectures have efficient support for saturation arithmetic on SIMD vectors, including SSE2 for x86 and NEON for ARM.  <\/p><\/blockquote>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u0430\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430. <\/p>\n<h2>\u041f\u043e\u0434\u0432\u0435\u0434\u0435\u043c \u0438\u0442\u043e\u0433\u0438<\/h2>\n<p>  \u041e\u0442\u0440\u0430\u0434\u043d\u043e, \u0447\u0442\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0438, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, undefined behavior \u0432 \u0421++ \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u0447\u0430\u0449\u0435. \u042d\u0442\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0440\u0430\u0434\u043e\u0432\u0430\u0442\u044c, \u0442\u0430\u043a \u043a\u0430\u043a proposal \u0438 \u0444\u0438\u0447, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 safety \u0438 security, \u043c\u043d\u043e\u0433\u043e, \u0438 \u0432\u0441\u0435 \u043e\u043d\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0434\u043e\u043b\u0436\u043d\u043e\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f.<\/p>\n<p>  \u0412 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u0421++ \u0432\u0441\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u0448\u0430\u043d\u0441\u043e\u0432 \u0441\u043b\u043e\u0432\u0438\u0442\u044c undefined behavior \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u2014 \u043f\u043e \u043d\u0435\u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u043b\u0438 \u043d\u0435\u0437\u043d\u0430\u043d\u0438\u044e. \u0422\u043e \u0435\u0441\u0442\u044c UB \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043a\u0440\u044b\u0442\u044b\u043c, \u0438 \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u0445\u043e\u0440\u043e\u0448\u043e.<\/p>\n<p>  \u041d\u043e, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0432\u044b\u043f\u0438\u043b\u0438\u0432\u0430\u043d\u0438\u0435 undefined behavior \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0435 \u0431\u044b\u0441\u0442\u0440\u043e. \u0412\u0441\u0435-\u0442\u0430\u043a\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u2014 \u044d\u0442\u043e \u0432\u043e\u043b\u043e\u043a\u0438\u0442\u0430, \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u0435, \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435, \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u043d\u044e\u0430\u043d\u0441\u043e\u0432 \u0438 \u043b\u0435\u0433\u0430\u0441\u0438-\u043a\u043e\u0434. <\/p>\n<p>  \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u0432 \u0447\u0435\u043c \u0442\u043e\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u043c, \u044d\u0442\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u0435\u0442 \u043d\u0430 \u0440\u0430\u043a\u0435\u0442\u0435 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u0421++ \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0435\u0439 \u0438 \u043d\u0435\u0442 \u043f\u0440\u0435\u0434\u0435\u043b\u0430 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u0443 (\u0438\u043b\u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e \u2014 \u043d\u0435 \u043f\u0440\u0435\u0434\u0435\u043b). <\/p>\n<p>  \u0410 \u0442\u0430\u043a\u0436\u0435 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e C++ \u2014 <a href=\"https:\/\/kas.pr\/habr_cpp_best\">\u043e\u0442\u043d\u044e\u0434\u044c \u043d\u0435 \u043b\u0443\u0447\u0448\u0438\u0439 \u044f\u0437\u044b\u043a, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0432 \u043d\u043e\u0433\u0443<\/a> \ud83d\ude42<\/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\/822373\/\"> https:\/\/habr.com\/ru\/articles\/822373\/<\/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\">Undefined behavior (UB) \u2014 \u0431\u043e\u043b\u044c, \u0437\u043d\u0430\u043a\u043e\u043c\u0430\u044f \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u0441\u043e \u0441\u0442\u0430\u0436\u0435\u043c; \u044d\u0434\u0430\u043a\u0438\u0439 \u00ab\u043a\u043e\u0434 \u0428\u0440\u0435\u0434\u0438\u043d\u0433\u0435\u0440\u0430\u00bb, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0437\u043d\u0430\u0435\u0448\u044c, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0442\u043e\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u043b\u0438 \u043d\u0435\u0442. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u044b \u044f\u0437\u044b\u043a\u0430 \u0421++20\/23\/26 \u043f\u0440\u0438\u0432\u043d\u0435\u0441\u043b\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u0435-\u0447\u0442\u043e \u043d\u043e\u0432\u043e\u0435. \u0418 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0432\u0430\u0436\u043d\u043e\u0435, \u0435\u0441\u043b\u0438 \u0432\u044b \u2014 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440 \u041f\u041e, \u0430 \u00ab\u043f\u043b\u044e\u0441\u044b\u00bb \u2014 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0441\u0442\u0435\u043a \u0432\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u0432 \u00ab\u041b\u0430\u0431\u043e\u0440\u0430\u0442\u043e\u0440\u0438\u0438 \u041a\u0430\u0441\u043f\u0435\u0440\u0441\u043a\u043e\u0433\u043e\u00bb \u043c\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0421++, \u0447\u0438\u0442\u0430\u0439\u0442\u0435 <a href=\"https:\/\/kas.pr\/habr_cpp_tutorial_dev\">\u0437\u0434\u0435\u0441\u044c<\/a>).<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0441\u043e \u0441\u0432\u043e\u0438\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0439 Senior Software Architect \u0438 Security Champion \u0432 <a href=\"https:\/\/kas.pr\/cpp_standart_kasperskyos\">\u043c\u0438\u043a\u0440\u043e\u044f\u0434\u0435\u0440\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 KasperskyOS<\/a> \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u043a\u0435\u0439\u0441\u044b-\u043b\u043e\u0432\u0443\u0448\u043a\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u043b\u044e\u0431\u043e\u043c \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u0432, \u0438 \u043f\u043e\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0421++20\/23\/26, \u2014 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f \u043b\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u0435\u0439\u0441\u043e\u0432 \u0441 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c, \u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043b\u0438 \u0421++ \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0435\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/eo\/cu\/sf\/eocusf3rf9zzy-aio6winoenigq.png\" data-src=\"https:\/\/habrastorage.org\/webt\/eo\/cu\/sf\/eocusf3rf9zzy-aio6winoenigq.png\"\/>  <\/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-402681","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/402681","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=402681"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/402681\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=402681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=402681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=402681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}