{"id":453595,"date":"2025-03-28T09:01:35","date_gmt":"2025-03-28T09:01:35","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=453595"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=453595","title":{"rendered":"<span>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438? \u041d\u0435\u0442, \u043d\u0435 \u0441\u043b\u044b\u0448\u0430\u043b\u0438<\/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-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0420\u0430\u043d\u043e \u0438\u043b\u0438 \u043f\u043e\u0437\u0434\u043d\u043e \u043b\u044e\u0431\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043d\u0430 \u0421-\u043f\u043e\u0434\u043e\u0431\u043d\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u0438\u0434\u0435\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u043a\u0430\u043a \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0439. \u041f\u0440\u0438\u0447\u0438\u043d\u044b \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0437\u043d\u044b\u0435, \u0430 \u0432\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d. \u0412 \u044d\u0442\u043e\u0439 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u044d\u0442\u0443 \u0441\u043e\u043c\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0442\u0435\u0445\u043d\u0438\u043a\u0443 \u0438 \u043a\u0430\u043a\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u043d\u0435\u0441\u0442\u0438 \u0432 \u0432\u0430\u0448\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/292\/6b0\/c72\/2926b0c7205a6a66e1c91d780ab61014.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/post_images\/292\/6b0\/c72\/2926b0c7205a6a66e1c91d780ab61014.png\"\/><\/figure>\n<h3>\u041e \u0447\u0451\u043c \u0440\u0435\u0447\u044c?<\/h3>\n<p>\u0422\u0435\u043c\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u043d\u0435 \u0440\u0430\u0437 \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u043b\u0430\u0441\u044c \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445, \u043d\u043e \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0435\u0451 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e. \u041f\u0440\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 Open Source \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/pvs-studio.ru\/ru\/pvs-studio\/\">PVS-Studio<\/a> \u043d\u0430\u043c \u043f\u043e\u043f\u0430\u0434\u0430\u043b\u0438\u0441\u044c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u043a\u0430\u043a \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0439. \u0418 \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b\u0438\u0441\u044c \u0432 \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435, \u0443 \u043c\u043d\u043e\u0433\u0438\u0445 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441: &#171;\u0412\u0441\u0451 \u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0432 \u0447\u0451\u043c \u043e\u043d\u0438 \u043d\u0435 \u043f\u0440\u0430\u0432\u044b?&#187;.<\/p>\n<h3>\u0410 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0440?<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"cpp\">#define ROWS (2) #define COLS (4)  int main() {   int a[ROWS][COLS] = { 0, 1, 2, 3, 4, 5, 6, 7 };   for (int i = 0; i &lt; ROWS * COLS; ++i)   {     printf(\" %d\", a[0][i]);   }      return 0; } <\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 <code>a<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0439: \u0432 \u0446\u0438\u043a\u043b\u0435 \u043c\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0447\u0435\u0440\u0435\u0437 <code>a[0][i]<\/code>, \u0433\u0434\u0435 <code>i<\/code> \u043f\u0440\u043e\u0431\u0435\u0433\u0430\u0435\u0442 \u043e\u0442 <code>0<\/code> \u0434\u043e <code>ROWS * COLS<\/code>. \u0410 \u0447\u0442\u043e \u0442\u0443\u0442 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e? \u0412\u0435\u0434\u044c \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443, \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e:<\/p>\n<blockquote>\n<p>An array type describes a contiguously allocated nonempty set of objects with a particular member object type, called the element type. The element type shall be complete whenever the array type is specified.<\/p>\n<\/blockquote>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u043c\u0441\u044f \u043a \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430\u043c \u044f\u0437\u044b\u043a\u043e\u0432 C \u0438 C++, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u0441 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>C23<\/summary>\n<div class=\"spoiler__content\">\n<p>6.5.3.2\/2:<\/p>\n<p>A postfix expression followed by an expression in square brackets <code>[]<\/code> is a subscripted designation of an element of an array object. The definition of the subscript operator <code>[]<\/code> is that <code>E1[E2]<\/code> is identical to <code>(*((E1) + (E2)))<\/code>. Because of the conversion rules that apply to the binary <code>+<\/code> operator, if <code>E1<\/code> is an array object (equivalently, a pointer to the initial element of an array object) and <code>E2<\/code> is an integer,<\/p>\n<p><code>E1[E2]<\/code> designates the <code>E2<\/code>-th element of <code>E1<\/code> (counting from zero).<\/p>\n<p>6.5.7\/9:<\/p>\n<p>When an expression that has integer type is added to or subtracted from a pointer, the result has the type of the pointer operand. If the pointer operand points to an element of an array object, and the array is large enough, the result points to an element offset from the original element such that the difference of the subscripts of the resulting and original array elements equals the integer expression. In other words, if the expression <code>P<\/code> points to the <code>i<\/code>-th element of an array object, the expressions<\/p>\n<p><code>(P) + N<\/code> (equivalently, <code>N + (P)<\/code>) and <code>(P) - N<\/code> (where <code>N<\/code> has the value <code>n<\/code>) point to, respectively, the <code>i + n<\/code>-th and <code>i - n<\/code>-th elements of the array object, provided they exist. Moreover, if the expression <code>P<\/code> points to the last element of an array object, the expression <code>(P) + 1<\/code> points one past the last element of the array object, and if the expression <code>Q<\/code> points one past the last element of an array object, the expression <code>(Q) - 1<\/code> points to the last element of the array object. If the pointer operand and the result do not point to elements of the same array object or one past the last element of the array object, the behavior is undefined. If the addition or subtraction produces an overflow, the behavior is undefined. If the result points one past the last element of the array object, it shall not be used as the operand of a unary <code>*<\/code> operator that is evaluated.<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>C++23<\/summary>\n<div class=\"spoiler__content\">\n<p>7.6.1.2\/1:<\/p>\n<p>A subscript expression is a postfix expression followed by square brackets containing a possibly empty, comma-separated list of initializer-clauses that constitute the arguments to the subscript operator. The postfix-expression and the initialization of the object parameter of any applicable subscript operator function is sequenced before each expression in the expression-list and also before any default argument. The initialization of a non-object parameter of a subscript operator function S, including every associated value computation and side effect, is indeterminately sequenced with respect to that of any other non-object parameter of S.<\/p>\n<p>7.6.1.2\/2:<\/p>\n<p>With the built-in subscript operator, an expression-list shall be present, consisting of a single assignment-expression. One of the expressions shall be a glvalue of type &#171;array of T&#187; or a prvalue of type &#171;pointer to T&#187; and the other shall be a prvalue of unscoped enumeration or integral type. The result is of type &#171;T&#187;. The type &#171;T&#187; shall be a completely-defined object type. The expression <code>E1[E2]<\/code> is identical (by definition) to <code>*((E1)+(E2))<\/code>, except that in the case of an array operand, the result is an lvalue if that operand is an lvalue and an xvalue otherwise.<\/p>\n<p>7.6.6\/4:<\/p>\n<p>When an expression <code>J<\/code> that has integral type is added to or subtracted from an expression <code>P<\/code> of pointer type, the result has the type of <code>P<\/code>.<\/p>\n<ul>\n<li>\n<p>If <code>P<\/code> evaluates to a null pointer value and <code>J<\/code> evaluates to <code>0<\/code>, the result is a null pointer value.<\/p>\n<\/li>\n<li>\n<p>Otherwise, if <code>P<\/code> points to an array element <code>i<\/code> of an array object <code>x<\/code> with <code>n<\/code> elements, the expressions <code>P + J<\/code> and <code>J + P<\/code> (where <code>J<\/code> has the value <code>j<\/code>) point to the (possibly-hypothetical) array element <code>i + j<\/code> of <code>x<\/code> if <code>0 \u2264 i + j \u2264 n<\/code> and the expression <code>P - J<\/code> points to the (possibly-hypothetical) array element <code>i - j<\/code> of <code>x<\/code> if <code>0 \u2264 i \u2212 j \u2264 n<\/code><em>.<\/em><\/p>\n<\/li>\n<li>\n<p>Otherwise, the behavior is undefined.<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/details>\n<p>\u0415\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e, \u0442\u043e \u043e\u0431\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u043d\u0430\u043c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043c\u0435\u0449\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u043d\u043e \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0435\u0433\u043e \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e.<\/p>\n<p>\u0412\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0441 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c <code>a[2][4]<\/code>. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <code>a[0]<\/code> \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 <code>int[4]<\/code>, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043c\u043e\u0436\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 <code>[0...3]<\/code>. \u0418\u043d\u0430\u0447\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/terms\/0071\/\">\u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430<\/a>, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/terms\/0066\/\">\u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e<\/a>. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430.<\/p>\n<h3>\u0414\u0430 \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438?<\/h3>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0447\u0442\u0438\u0442\u0435 \u044d\u0442\u0443 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/1024\/\">\u0441\u0442\u0430\u0442\u044c\u044e<\/a>, \u0438 \u043e\u0442\u0432\u0435\u0442 \u0441\u0442\u0430\u043d\u0435\u0442 \u043e\u0447\u0435\u0432\u0438\u0434\u0435\u043d.<\/p>\n<p>\u041d\u043e \u043a\u0442\u043e \u043c\u044b \u0442\u0430\u043a\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0432\u0435\u0440\u0438\u0442\u044c &#171;\u043a\u0430\u043a\u043e\u0439-\u0442\u043e&#187; \u0441\u0442\u0430\u0442\u044c\u0435? \u041b\u0443\u0447\u0448\u0435 \u0432\u043e\u043e\u0440\u0443\u0436\u0438\u043c\u0441\u044f Compiler Explorer, \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 GCC 14.2 \u0438 \u0438\u0437\u0443\u0447\u0438\u043c \u043f\u043e\u0433\u043b\u0443\u0431\u0436\u0435, \u0447\u0442\u043e \u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 <a href=\"https:\/\/godbolt.org\/z\/szonP8GhM\">\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434<\/a> \u043f\u0440\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u0438 (\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435).<\/p>\n<details class=\"spoiler\">\n<summary>\u0410\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434 (x86-64, GCC 14.2)<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">.LC2:         .string \" %d\" main: ; \u041f\u0440\u043e\u043b\u043e\u0433 \u0444\u0443\u043d\u043a\u0446\u0438\u0438         push    r12         push    rbp         push    rbx ; \u0420\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 \u0441\u0442\u0435\u043a\u0435 \u043f\u043e\u0434 \u043c\u0430\u0441\u0441\u0438\u0432 int[2][4]         sub     rsp, 32 ; \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 a[0] \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 xmm0         movdqa  xmm0, XMMWORD PTR .LC0[rip] ; \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u0445\u0443\u0448\u043a\u0438 \u0441\u0442\u0435\u043a\u0430 \u0432 rbx         mov     rbx, rsp ; \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432 r12 one-past-the-end \u043e\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 a[0]         lea     r12, [rsp+16] ; \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f a[0] \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 xmm0         movaps  XMMWORD PTR [rsp], xmm0 ; \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 arr[1] \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 xmm0         movdqa  xmm0, XMMWORD PTR .LC1[rip] ; \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u0445\u0443\u0448\u043a\u0438 \u0441\u0442\u0435\u043a\u0430 \u0432 rbp         mov     rbp, rbx ; \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f a[1] \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 xmm0         movaps  XMMWORD PTR [rsp+16], xmm0 .L2: ; \u041f\u0435\u0447\u0430\u0442\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 a[0], \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0445\u0443\u0448\u043a\u0438 \u0441\u0442\u0435\u043a\u0430         mov     esi, DWORD PTR [rbp+0]         mov     edi, OFFSET FLAT:.LC2         xor     eax, eax         add     rbp, 4         call    printf ; \u0426\u0438\u043a\u043b \u0434\u043e \u043a\u043e\u043d\u0446\u0430 a[0] (r12)         cmp     r12, rbp         jne     .L2 .L3: ; \u041f\u0435\u0447\u0430\u0442\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 a[1]         mov     esi, DWORD PTR [rbx+16]         mov     edi, OFFSET FLAT:.LC2         xor     eax, eax         add     rbx, 4         call    printf ; \u0426\u0438\u043a\u043b \u0434\u043e \u043a\u043e\u043d\u0446\u0430 a[0] (r12)         cmp     r12, rbx         jne     .L3 ; \u042d\u043f\u0438\u043b\u043e\u0433 \u0444\u0443\u043d\u043a\u0446\u0438\u0438         add     rsp, 32         xor     eax, eax         pop     rbx         pop     rbp         pop     r12         ret ; \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 .LC0:         .long   0         .long   1         .long   2         .long   3 .LC1:         .long   4         .long   5         .long   6         .long   7 <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0443\u0431\u0435\u0436\u0434\u0435\u043d\u044b, \u0447\u0442\u043e \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e, \u0442\u043e \u0434\u043b\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b x86-64 \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0430\u043a: \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0439 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 \u0441\u0442\u0435\u043a\u0435 \u043f\u043e\u0434 \u0432\u0435\u0441\u044c \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432. \u0418 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0434\u0430\u043b\u044c\u0448\u0435 \u044d\u0442\u0438\u043c \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f.<\/p>\n<p>\u041e\u043d \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b \u043d\u0430\u0448 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0434\u043e \u0434\u0432\u0443\u0445 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445, \u0438\u0434\u0443\u0449\u0438\u0445 \u0434\u0440\u0443\u0433 \u0437\u0430 \u0434\u0440\u0443\u0433\u043e\u043c. \u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443 <code>a[0]<\/code> \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u043f\u0435\u0447\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u044d\u0442\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0412\u0442\u043e\u0440\u043e\u0439 \u0446\u0438\u043a\u043b \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443 <code>a[0]<\/code>, \u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u043f\u0435\u0447\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>a[1]<\/code> \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u0434\u0432\u0438\u0433\u0430 \u043d\u0430 16 \u0431\u0430\u0439\u0442, \u0442.\u0435. \u043d\u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>a[0]<\/code> \u0432 4 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430.<\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043d\u0430\u0448\u0438\u043c\u0438 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f\u043c\u0438:<\/p>\n<pre><code class=\"cpp\">ASM generation compiler returned: 0 Execution build compiler returned: 0 Program returned: 0  0 1 2 3 4 5 6 7 <\/code><\/pre>\n<p>\u041d\u0443 \u0440\u0430\u0437 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u0434, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u0435\u0441\u044c \u043b\u0435\u0436\u0438\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0442\u043e \u0443 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441:<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/\/post_images\/ebe\/90a\/459\/ebe90a4597b19cfcb3ee2becbaec6509.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/\/post_images\/ebe\/90a\/459\/ebe90a4597b19cfcb3ee2becbaec6509.png\"\/><\/figure>\n<p>\u041f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u0434 \u043d\u0430 \u043e\u0434\u0438\u043d \u0446\u0438\u043a\u043b \u0438 <a href=\"https:\/\/godbolt.org\/z\/o7dxssxs4\">\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c<\/a> \u044d\u0442\u043e \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>\u0410\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u0435\u0439, \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e (x86-64, GCC 14.2)<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">.LC1:         .string \" %d\" main:         push    rbx ; \u0420\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 \u0441\u0442\u0435\u043a\u0435 \u043f\u043e\u0434 \u043c\u0430\u0441\u0441\u0438\u0432 int[2][4]         sub     rsp, 32 ; \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 a[0] \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 xmm0         movdqa  xmm0, XMMWORD PTR .LC0[rip] ; \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u0445\u0443\u0448\u043a\u0438 \u0441\u0442\u0435\u043a\u0430 \u0432 rbx         mov     rbx, rsp ; \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f a[0] \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 xmm0         movaps  XMMWORD PTR [rsp], xmm0 .L2:  ; \u041f\u0435\u0447\u0430\u0442\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430         mov     esi, DWORD PTR [rbx]         mov     edi, OFFSET FLAT:.LC1         xor     eax, eax         add     rbx, 4         call    printf ; \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u043a\u043e\u043d\u0446\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430         lea     rax, [rsp+32] ; \u0426\u0438\u043a\u043b \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430         cmp     rbx, rax         jne     .L2         add     rsp, 32         xor     eax, eax         pop     rbx         ret .LC0:         .long   0         .long   1         .long   2         .long   3 <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0420\u0430\u0437\u043d\u0438\u0446\u0443 \u0432 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c <a href=\"https:\/\/godbolt.org\/z\/bqTTsqn9n\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0441\u0442\u0430\u043b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 <code>a[1]<\/code>. \u0417\u0430\u0447\u0435\u043c \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438 \u043f\u0435\u0447\u0430\u0442\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u043f\u0440\u0430\u0432\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e.<\/p>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u0430\u0448\u0435\u0433\u043e \u0432\u0435\u0437\u0435\u043d\u0438\u044f, \u0444\u0430\u0437 \u041b\u0443\u043d\u044b \u0438 \u0443\u043c\u0435\u043d\u0438\u044f \u0433\u0430\u0434\u0430\u0442\u044c \u043d\u0430 \u043a\u043e\u0444\u0435\u0439\u043d\u043e\u0439 \u0433\u0443\u0449\u0435. \u0412\u043e\u0442 \u0447\u0442\u043e \u0432\u044b\u0434\u0430\u043b\u043e\u0441\u044c \u043c\u043d\u0435 \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437:<\/p>\n<pre><code class=\"cpp\">ASM generation compiler returned: 0 Execution build compiler returned: 0 Program returned: 0  0 1 2 3 -994840135 32766 100 0 <\/code><\/pre>\n<p>\u0427\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 GCC \u0432 \u044d\u0442\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0432\u044b\u0434\u0430\u043b \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"cpp\">&lt;source&gt;:11:5: warning: iteration 4 invokes                         undefined behavior [-Waggressive-loop-optimizations]    11 |     printf(\" %d\", a[0][i]);       |     ^~~~~~~~~~~~~~~~~~~~~~ &lt;source&gt;:9:21: note: within this loop     9 |   for (int i = 0; i &lt; ROWS * COLS; ++i)       |                     ^ <\/code><\/pre>\n<p>\u0410 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0432\u044b\u0434\u0430\u0451\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v557\/\">V557<\/a> Array overrun is possible. The value of &#8216;i&#8217; index could reach 7.<\/p>\n<h3>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c?<\/h3>\n<p>\u041e\u0442\u0432\u0435\u0442 \u043f\u0440\u043e\u0441\u0442 \u2014 \u043f\u0438\u0448\u0438\u0442\u0435 \u0446\u0438\u043a\u043b\u044b \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e, \u043d\u0435 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \ud83d\ude42<\/p>\n<p>\u041d\u043e \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u043c\u0430\u0441\u0441\u0438\u0432 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u043b\u0435\u0436\u0430\u043b \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0438\u043c\u0435\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043d\u0435\u043c\u0443 \u043a\u0430\u043a \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u043c\u0443, \u0442\u0430\u043a \u0438 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u043e\u043c\u0443? \u0414\u043b\u044f C++ \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0435\u0441\u0442\u044c: \u0432 C++23 \u0431\u044b\u043b \u0432\u0432\u0435\u0434\u0451\u043d <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/container\/mdspan\"><code>std::mdspan<\/code><\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 \u043b\u044e\u0431\u043e\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430 <a href=\"https:\/\/godbolt.org\/z\/xvYPfTKx1\">\u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/a>:<\/p>\n<pre><code class=\"cpp\">int main() {   int a[ROWS * COLS] = { 0, 1, 2, 3, 4, 5, 6, 7 };     auto view_2d = std::mdspan { a, ROWS, COLS };   for (auto i = 0uz; i &lt; ROWS; ++i)   {     for (auto j = 0uz; j &lt; COLS; ++j)     {       printf(\" %d\", view_2d[i, j]);     }   } } <\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432, \u043d\u043e \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0442\u0440\u0430\u043a\u0442\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442 <code>std::mdspan<\/code> \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043f\u043e\u0434 \u043a\u043e\u0440\u043e\u0431\u043a\u043e\u0439 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043a\u043e\u043f\u0438\u0439 \u043d\u0430\u0448\u0435\u0433\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0442.\u043a. \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0432\u043b\u0430\u0434\u0435\u044e\u0449\u0435\u0439 \u043e\u0431\u0451\u0440\u0442\u043a\u043e\u0439.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/strong> \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438 <code>std::mdspan<\/code> \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0432 Clang 18 (libc++). \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0432 \u043f\u0440\u043e\u0447\u0438\u0445 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 &#171;<a href=\"https:\/\/en.cppreference.com\/w\/cpp\/compiler_support\">\u0421++ compiler support<\/a>&#187; \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u043f\u043e \u0444\u0440\u0430\u0437\u0435 &#171;std::mdspan: a non-owning multidimensional array reference&#187;.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u044d\u0442\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043c\u043e\u0433\u043b\u0430 \u0432\u0430\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043a\u0430\u043a \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e.<\/p>\n<p>\u041c\u044b \u0443\u0436\u0435 \u043d\u0435 \u0440\u0430\u0437 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/examples\/v557\/\">\u0432\u0438\u0434\u0435\u043b\u0438<\/a> \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b\u0438 \u0438\u0445 \u0432 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/\">\u0441\u0442\u0430\u0442\u044c\u044f\u0445<\/a>. \u041e\u0434\u043d\u0430\u043a\u043e, \u0447\u0442\u043e\u0431\u044b \u0438 \u0432\u0430\u043c \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0449\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043e\u043f\u0430\u0441\u043d\u044b\u0435 \u0443\u0447\u0430\u0441\u0442\u043a\u0438 \u043a\u043e\u0434\u0430 \u0432 \u0441\u0432\u043e\u0451\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e <a href=\"https:\/\/pvs-studio.ru\/ru\/pvs-studio\/try-free\/?utm_source=website&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=1241\">\u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c<\/a> \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439 \u0441 \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0435\u0439, \u0442\u043e \u043f\u0440\u043e\u0448\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434: Aleksandra Uvarova. <a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/cpp\/1241\/\">Safe array handling? Never heard of it<\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/895208\/\"> https:\/\/habr.com\/ru\/articles\/895208\/<\/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-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0420\u0430\u043d\u043e \u0438\u043b\u0438 \u043f\u043e\u0437\u0434\u043d\u043e \u043b\u044e\u0431\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043d\u0430 \u0421-\u043f\u043e\u0434\u043e\u0431\u043d\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u0438\u0434\u0435\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u043a\u0430\u043a \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0439. \u041f\u0440\u0438\u0447\u0438\u043d\u044b \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0437\u043d\u044b\u0435, \u0430 \u0432\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d. \u0412 \u044d\u0442\u043e\u0439 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u044d\u0442\u0443 \u0441\u043e\u043c\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0442\u0435\u0445\u043d\u0438\u043a\u0443 \u0438 \u043a\u0430\u043a\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u043d\u0435\u0441\u0442\u0438 \u0432 \u0432\u0430\u0448\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443.<\/p>\n<figure class=\"\"><\/figure>\n<h3>\u041e \u0447\u0451\u043c \u0440\u0435\u0447\u044c?<\/h3>\n<p>\u0422\u0435\u043c\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u043d\u0435 \u0440\u0430\u0437 \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u043b\u0430\u0441\u044c \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445, \u043d\u043e \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0435\u0451 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e. \u041f\u0440\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 Open Source \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/pvs-studio.ru\/ru\/pvs-studio\/\">PVS-Studio<\/a> \u043d\u0430\u043c \u043f\u043e\u043f\u0430\u0434\u0430\u043b\u0438\u0441\u044c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u043a\u0430\u043a \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0439. \u0418 \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b\u0438\u0441\u044c \u0432 \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435, \u0443 \u043c\u043d\u043e\u0433\u0438\u0445 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441: &#171;\u0412\u0441\u0451 \u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0432 \u0447\u0451\u043c \u043e\u043d\u0438 \u043d\u0435 \u043f\u0440\u0430\u0432\u044b?&#187;.<\/p>\n<h3>\u0410 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0440?<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"cpp\">#define ROWS (2) #define COLS (4)  int main() {   int a[ROWS][COLS] = { 0, 1, 2, 3, 4, 5, 6, 7 };   for (int i = 0; i &lt; ROWS * COLS; ++i)   {     printf(\" %d\", a[0][i]);   }      return 0; } <\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 <code>a<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0439: \u0432 \u0446\u0438\u043a\u043b\u0435 \u043c\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0447\u0435\u0440\u0435\u0437 <code>a[0][i]<\/code>, \u0433\u0434\u0435 <code>i<\/code> \u043f\u0440\u043e\u0431\u0435\u0433\u0430\u0435\u0442 \u043e\u0442 <code>0<\/code> \u0434\u043e <code>ROWS * COLS<\/code>. \u0410 \u0447\u0442\u043e \u0442\u0443\u0442 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e? \u0412\u0435\u0434\u044c \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443, \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e:<\/p>\n<blockquote>\n<p>An array type describes a contiguously allocated nonempty set of objects with a particular member object type, called the element type. The element type shall be complete whenever the array type is specified.<\/p>\n<\/blockquote>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0439 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u043c\u0441\u044f \u043a \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430\u043c \u044f\u0437\u044b\u043a\u043e\u0432 C \u0438 C++, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u0441 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>C23<\/summary>\n<div class=\"spoiler__content\">\n<p>6.5.3.2\/2:<\/p>\n<p>A postfix expression followed by an expression in square brackets <code>[]<\/code> is a subscripted designation of an element of an array object. The definition of the subscript operator <code>[]<\/code> is that <code>E1[E2]<\/code> is identical to <code>(*((E1) + (E2)))<\/code>. Because of the conversion rules that apply to the binary <code>+<\/code> operator, if <code>E1<\/code> is an array object (equivalently, a pointer to the initial element of an array object) and <code>E2<\/code> is an integer,<\/p>\n<p><code>E1[E2]<\/code> designates the <code>E2<\/code>-th element of <code>E1<\/code> (counting from zero).<\/p>\n<p>6.5.7\/9:<\/p>\n<p>When an expression that has integer type is added to or subtracted from a pointer, the result has the type of the pointer operand. If the pointer operand points to an element of an array object, and the array is large enough, the result points to an element offset from the original element such that the difference of the subscripts of the resulting and original array elements equals the integer expression. In other words, if the expression <code>P<\/code> points to the <code>i<\/code>-th element of an array object, the expressions<\/p>\n<p><code>(P) + N<\/code> (equivalently, <code>N + (P)<\/code>) and <code>(P) - N<\/code> (where <code>N<\/code> has the value <code>n<\/code>) point to, respectively, the <code>i + n<\/code>-th and <code>i - n<\/code>-th elements of the array object, provided they exist. Moreover, if the expression <code>P<\/code> points to the last element of an array object, the expression <code>(P) + 1<\/code> points one past the last element of the array object, and if the expression <code>Q<\/code> points one past the last element of an array object, the expression <code>(Q) - 1<\/code> points to the last element of the array object. If the pointer operand and the result do not point to elements of the same array object or one past the last element of the array object, the behavior is undefined. If the addition or subtraction produces an overflow, the behavior is undefined. If the result points one past the last element of the array object, it shall not be used as the operand of a unary <code>*<\/code> operator that is evaluated.<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>C++23<\/summary>\n<div class=\"spoiler__content\">\n<p>7.6.1.2\/1:<\/p>\n<p>A subscript expression is a postfix expression followed by square brackets containing a possibly empty, comma-separated list of initializer-clauses that constitute the arguments to the subscript operator. The postfix-expression and the initialization of the object parameter of any applicable subscript operator function is sequenced before each expression in the expression-list and also before any default argument. The initialization of a non-object parameter of a subscript operator function S, including every associated value computation and side effect, is indeterminately sequenced with respect to that of any other non-object parameter of S.<\/p>\n<p>7.6.1.2\/2:<\/p>\n<p>With the built-in subscript operator, an expression-list shall be present, consisting of a single assignment-expression. One of the expressions shall be a glvalue of type &#171;array of T&#187; or a prvalue of type &#171;pointer to T&#187; and the other shall be a prvalue of unscoped enumeration or integral type. The result is of type &#171;T&#187;. The type &#171;T&#187; shall be a completely-defined object type. The expression <code>E1[E2]<\/code> is identical (by definition) to <code>*((E1)+(E2))<\/code>, except that in the case of an array operand, the result is an lvalue if that operand is an lvalue and an xvalue otherwise.<\/p>\n<p>7.6.6\/4:<\/p>\n<p>When an expression <code>J<\/code> that has integral type is added to or subtracted from an expression <code>P<\/code> of pointer type, the result has the type of <code>P<\/code>.<\/p>\n<ul>\n<li>\n<p>If <code>P<\/code> evaluates to a null pointer value and <code>J<\/code> evaluates to <code>0<\/code>, the result is a null pointer value.<\/p>\n<\/li>\n<li>\n<p>Otherwise, if <code>P<\/code> points to an array element <code>i<\/code> of an array object <code>x<\/code> with <code>n<\/code> elements, the expressions <code>P + J<\/code> and <code>J + P<\/code> (where <code>J<\/code> has the value <code>j<\/code>) point to the (possibly-hypothetical) array element <code>i + j<\/code> of <code>x<\/code> if <code>0 \u2264 i + j \u2264 n<\/code> and the expression <code>P - J<\/code> points to the (possibly-hypothetical) array element <code>i - j<\/code> of <code>x<\/code> if <code>0 \u2264 i \u2212 j \u2264 n<\/code><em>.<\/em><\/p>\n<\/li>\n<li>\n<p>Otherwise, the behavior is undefined.<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/details>\n<p>\u0415\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e, \u0442\u043e \u043e\u0431\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u043d\u0430\u043c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043c\u0435\u0449\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u043d\u043e \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0435\u0433\u043e \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e.<\/p>\n<p>\u0412\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0441 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c <code>a[2][4]<\/code>. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <code>a[0]<\/code> \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 <code>int[4]<\/code>, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043c\u043e\u0436\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 <code>[0...3]<\/code>. \u0418\u043d\u0430\u0447\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/terms\/0071\/\">\u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430<\/a>, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/terms\/0066\/\">\u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e<\/a>. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430.<\/p>\n<h3>\u0414\u0430 \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438?<\/h3>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0447\u0442\u0438\u0442\u0435 \u044d\u0442\u0443 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/1024\/\">\u0441\u0442\u0430\u0442\u044c\u044e<\/a>, \u0438 \u043e\u0442\u0432\u0435\u0442 \u0441\u0442\u0430\u043d\u0435\u0442 \u043e\u0447\u0435\u0432\u0438\u0434\u0435\u043d.<\/p>\n<p>\u041d\u043e \u043a\u0442\u043e \u043c\u044b \u0442\u0430\u043a\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0432\u0435\u0440\u0438\u0442\u044c &#171;\u043a\u0430\u043a\u043e\u0439-\u0442\u043e&#187; \u0441\u0442\u0430\u0442\u044c\u0435? \u041b\u0443\u0447\u0448\u0435 \u0432\u043e\u043e\u0440\u0443\u0436\u0438\u043c\u0441\u044f Compiler Explorer, \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 GCC 14.2 \u0438 \u0438\u0437\u0443\u0447\u0438\u043c \u043f\u043e\u0433\u043b\u0443\u0431\u0436\u0435, \u0447\u0442\u043e \u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 <a href=\"https:\/\/godbolt.org\/z\/szonP8GhM\">\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434<\/a> \u043f\u0440\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u0438 (\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435).<\/p>\n<details class=\"spoiler\">\n<summary>\u0410\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434 (x86-64, GCC 14.2)<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">.LC2:         .string \" %d\" main: ; \u041f\u0440\u043e\u043b\u043e\u0433 \u0444\u0443\u043d\u043a\u0446\u0438\u0438         push    r12         push    rbp         push    rbx ; \u0420\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 \u0441\u0442\u0435\u043a\u0435 \u043f\u043e\u0434 \u043c\u0430\u0441\u0441\u0438\u0432 int[2][4]         sub     rsp, 32 ; \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 a[0] \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 xmm0         movdqa  xmm0, XMMWORD PTR .LC0[rip] ; \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u0445\u0443\u0448\u043a\u0438 \u0441\u0442\u0435\u043a\u0430 \u0432 rbx         mov     rbx, rsp ; \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432 r12 one-past-the-end \u043e\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 a[0]         lea     r12, [rsp+16] ; \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f a[0] \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 xmm0         movaps  XMMWORD PTR [rsp], xmm0 ; \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 arr[1] \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 xmm0         movdqa  xmm0, XMMWORD PTR .LC1[rip] ; \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u0445\u0443\u0448\u043a\u0438 \u0441\u0442\u0435\u043a\u0430 \u0432 rbp         mov     rbp, rbx ; \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f a[1] \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 xmm0         movaps  XMMWORD PTR [rsp+16], xmm0 .L2: ; \u041f\u0435\u0447\u0430\u0442\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 a[0], \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0445\u0443\u0448\u043a\u0438 \u0441\u0442\u0435\u043a\u0430         mov     esi, DWORD PTR [rbp+0]         mov     edi, OFFSET FLAT:.LC2         xor     eax, eax         add     rbp, 4         call    printf ; \u0426\u0438\u043a\u043b \u0434\u043e \u043a\u043e\u043d\u0446\u0430 a[0] (r12)         cmp     r12, rbp         jne     .L2 .L3: ; \u041f\u0435\u0447\u0430\u0442\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 a[1]         mov     esi, DWORD PTR [rbx+16]         mov     edi, OFFSET FLAT:.LC2         xor     eax, eax         add     rbx, 4         call    printf ; \u0426\u0438\u043a\u043b \u0434\u043e \u043a\u043e\u043d\u0446\u0430 a[0] (r12)         cmp     r12, rbx         jne     .L3 ; \u042d\u043f\u0438\u043b\u043e\u0433 \u0444\u0443\u043d\u043a\u0446\u0438\u0438         add     rsp, 32         xor     eax, eax         pop     rbx         pop     rbp         pop     r12         ret ; \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 .LC0:         .long   0         .long   1         .long   2         .long   3 .LC1:         .long   4         .long   5         .long   6         .long   7 <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0443\u0431\u0435\u0436\u0434\u0435\u043d\u044b, \u0447\u0442\u043e \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e, \u0442\u043e \u0434\u043b\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b x86-64 \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0430\u043a: \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0439 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 \u0441\u0442\u0435\u043a\u0435 \u043f\u043e\u0434 \u0432\u0435\u0441\u044c \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432. \u0418 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0434\u0430\u043b\u044c\u0448\u0435 \u044d\u0442\u0438\u043c \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f.<\/p>\n<p>\u041e\u043d \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b \u043d\u0430\u0448 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0434\u043e \u0434\u0432\u0443\u0445 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445, \u0438\u0434\u0443\u0449\u0438\u0445 \u0434\u0440\u0443\u0433 \u0437\u0430 \u0434\u0440\u0443\u0433\u043e\u043c. \u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443 <code>a[0]<\/code> \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u043f\u0435\u0447\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u044d\u0442\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0412\u0442\u043e\u0440\u043e\u0439 \u0446\u0438\u043a\u043b \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443 <code>a[0]<\/code>, \u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u043f\u0435\u0447\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>a[1]<\/code> \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u0434\u0432\u0438\u0433\u0430 \u043d\u0430 16 \u0431\u0430\u0439\u0442, \u0442.\u0435. \u043d\u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>a[0]<\/code> \u0432 4 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430.<\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043d\u0430\u0448\u0438\u043c\u0438 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f\u043c\u0438:<\/p>\n<pre><code class=\"cpp\">ASM generation compiler returned: 0 Execution build compiler returned: 0 Program returned: 0  0 1 2 3 4 5 6 7 <\/code><\/pre>\n<p>\u041d\u0443 \u0440\u0430\u0437 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u0434, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043d\u043e\u0433\u043e\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u0435\u0441\u044c \u043b\u0435\u0436\u0438\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0442\u043e \u0443 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u043e\u043f\u0440\u043e\u0441:<\/p>\n<figure class=\"\"><\/figure>\n<p>\u041f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u0434 \u043d\u0430 \u043e\u0434\u0438\u043d \u0446\u0438\u043a\u043b \u0438 <a href=\"https:\/\/godbolt.org\/z\/o7dxssxs4\">\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c<\/a> \u044d\u0442\u043e \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>\u0410\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u0435\u0439, \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e (x86-64, GCC 14.2)<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">.LC1:         .string \" %d\" main:         push    rbx ; \u0420\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 \u0441\u0442\u0435\u043a\u0435 \u043f\u043e\u0434 \u043c\u0430\u0441\u0441\u0438\u0432 int[2][4]         sub     rsp, 32 ; \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 a[0] \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 xmm0         movdqa  xmm0, XMMWORD PTR .LC0[rip] ; \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u0445\u0443\u0448\u043a\u0438 \u0441\u0442\u0435\u043a\u0430 \u0432 rbx         mov     rbx, rsp ; \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f a[0] \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 xmm0         movaps  XMMWORD PTR [rsp], xmm0 .L2:  ; \u041f\u0435\u0447\u0430\u0442\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430         mov     esi, DWORD PTR [rbx]         mov     edi, OFFSET FLAT:.LC1         xor     eax, eax         add     rbx, 4         call    printf ; \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u043a\u043e\u043d\u0446\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430         lea     rax, [rsp+32] ; \u0426\u0438\u043a\u043b \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430         cmp     rbx, rax         jne     .L2         add     rsp, 32         xor     eax, eax         pop     rbx         ret .LC0:         .long   0         .long   1         .long   2         .long   3 <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0420\u0430\u0437\u043d\u0438\u0446\u0443 \u0432 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c <a href=\"https:\/\/godbolt.org\/z\/bqTTsqn9n\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-453595","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/453595","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=453595"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/453595\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=453595"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=453595"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=453595"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}