{"id":256121,"date":"2015-04-27T16:58:02","date_gmt":"2015-04-27T12:58:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=256121"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=256121","title":{"rendered":"\u041e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u0438\u043b\u0438 \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043c\u043e\u043b\u0447\u0438\u0442"},"content":{"rendered":"<p>     \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/3de\/ad6\/ea6\/3dead6ea6bbc15fba92c714026017a76.png\" alt=\"image\"\/><\/p>\n<pre><code class=\"cpp\">++recoveryModePublicationCount; \/\/ \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0443\u0436\u0435 n-\u0439 \u0440\u0430\u0437 <\/code><\/pre>\n<p>  \u0414\u043e\u0440\u043e\u0433\u043e\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u0435\u0441\u043b\u0438 \u0442\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0448\u044c \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0421 (\u043d\u0435 \u0421++) \u0438\u043b\u0438 \u0445\u043e\u0447\u0435\u0448\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u043d\u0438\u044f (\u0438\u0437 \u0443\u0440\u043e\u0432\u043d\u044f \u043f\u0440\u043e\u043f\u0438\u0441\u043d\u044b\u0445 \u0438\u0441\u0442\u0438\u043d) \u0442\u043e\u0433\u0434\u0430 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043b\u0438\u0448\u0438\u0442 \u0442\u0435\u0431\u044f \u0441\u0447\u0430\u0441\u0442\u044c\u044f \u043f\u0440\u043e\u0441\u0442\u0440\u0435\u043b\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u043d\u043e\u0433\u0443 \u043f\u0430\u0440\u0443 \u0440\u0430\u0437 \u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439.<\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0439<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0432\u043e\u0434\u0443 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u0438 \u043a\u043d\u0438\u0433, \u043d\u043e \u044f \u0435\u0449\u0435 \u0440\u0430\u0437 \u043f\u043e\u0432\u0442\u043e\u0440\u044e\u0441\u044c, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442 \u0438\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c, \u0430 \u043d\u0435 \u043d\u0430\u0431\u043e\u0440 \u0431\u0443\u043a\u0432, \u043a\u0430\u043a \u0430, b, c, i. \u041b\u0443\u0447\u0448\u0435 array, iterator, pointer, index \u0438 \u0442.\u0434. \u0438 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u0430\u043d\u0430\u043b\u0438\u0437 \u043a\u043e\u0434\u0430 \u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u044b\u0440\u0430\u0441\u0442\u0435\u0442 \u0432 \u0440\u0430\u0437\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0432\u044b, \u0438\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0439.  <\/div>\n<\/div>\n<h4>\u0420\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432<\/h4>\n<p>  \u0418\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0447\u0442\u043e \u0432\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u0432 \u0421 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0440\u0435\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438\u0437 stdlib \u2013 malloc, calloc, realloc. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0442\u0443\u0442 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u0432\u0441\u0435 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u043f\u0430\u043c\u044f\u0442\u0438 \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0432 \u0431\u0430\u0439\u0442\u0430\u0445, \u0430 \u043d\u0435 \u0432 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<br \/>  \u0418 \u0435\u0441\u043b\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0421 \u0441 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432, \u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0431\u044b\u0442\u044c, \u0438 \u043f\u043e\u0442\u043e\u043c \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 realloc \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0441\u0442\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 m-\u0433\u043e \u043f\u043e\u043b\u044f \u0432 n-\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435.<\/p>\n<p>  \u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f:  <\/p>\n<pre><code class=\"cpp\">int *array = malloc(10); <\/code><\/pre>\n<p>  \u0418 \u0442\u0443\u0442 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0448\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u043b\u0443\u0447\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 3-\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e (array[3] = 1;) \u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0448\u044c <a href=\"https:\/\/ru.wikipedia.org\/wiki\/SIGSEGV\">SIGSEGV<\/a>, \u0438 \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0448\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e.<\/p>\n<p>  \u0412\u0441\u0435\u0433\u0434\u0430 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435:<\/p>\n<pre><code class=\"cpp\">Type *array = malloc(sizeof(Type) * arraySize);  <\/code><\/pre>\n<p>  \u0422.\u0435. \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e   <\/p>\n<pre><code class=\"cpp\">int *array = malloc(sizeof(int)  * 10);  <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0448\u0435 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u0430\u043c\u044f\u0442\u044c \u043d\u0430 10 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0442\u0438\u043f\u0430 int \u0432 \u043a\u0443\u0447\u0435.<\/p>\n<h4>Realloc <\/h4>\n<p>  \u0422\u0443\u0442 \u0436\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 realloc\u2019e, \u0433\u0434\u0435 \u0440\u0430\u0437\u043c\u0435\u0440 \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u043d\u0435 \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430 sizeof(type).<br \/>  \u041f\u043e\u0447\u0442\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430:<\/p>\n<pre><code class=\"cpp\">realloc(somePtr, sizeof(type) * newArrayCount); <\/code><\/pre>\n<p>  \u0415\u0449\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 realloc\u2019a \u2013 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u044e\u0442, \u0447\u0442\u043e realloc \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0439 \u0435\u043c\u0443 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0432 \u0441\u043e\u0432\u0441\u0435\u043c \u0434\u0440\u0443\u0433\u043e\u0435 \u043c\u0435\u0441\u0442\u043e. \u041e\u0442\u0441\u044e\u0434\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 realloc:<\/p>\n<pre><code class=\"cpp\">newPtr = realloc(somePtr, sizeof(type) * newArrayCount); <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 newPtr \u0438 somePtr \u043e\u0431\u044b\u0447\u043d\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442, \u043d\u043e true debug \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f, \u0438 \u043e\u043f\u044f\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c SIGSEGV. <\/p>\n<p>  \u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u043c\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u043c\u0430\u043a\u0440\u043e, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0430\u043c \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 sizeof \u043e\u0442 \u0442\u0438\u043f\u0430. <\/p>\n<pre><code class=\"cpp\">#define arraySize(className, size)                        (sizeof(className) * size) <\/code><\/pre>\n<p>  \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u0444\u043e\u0440\u043c\u0435:<\/p>\n<pre><code class=\"cpp\">int *first = malloc(arraySize(int, 10)); <\/code><\/pre>\n<p>  \u0430 \u043f\u0435\u0440\u0435\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">int *second = realloc(first, arraySize(int, 20)); <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0435\u0441\u043b\u0438 \u043f\u0430\u043c\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u0442.\u0435. second != first, \u0442\u043e \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 first \u043a\u043e\u043f\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 second (), \u0430 first \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0438 \u0441\u0442\u0430\u0435\u0442 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u043c (\u043d\u043e \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u043d\u0435 nil, \u0442\u0430\u043a \u0447\u0442\u043e \u0437\u0430\u043d\u0443\u043b\u044f\u0439\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 free, \u0434\u043b\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f). <\/p>\n<p>  \u042f \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0435\u0449\u0435 \u0434\u0432\u0430 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043c\u0430\u043a\u0440\u043e \u0434\u043b\u044f \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u044c\u0435\u043a\u0442\u0430 \u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043e\u0431\u044c\u0435\u043a\u0442\u043e\u0432:  <\/p>\n<pre><code class=\"cpp\">#define allocator(className)                              malloc(sizeof(className)) #define arrayAllocator(className, size)             malloc(sizeof(className) * (size)) <\/code><\/pre>\n<p>  \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"cpp\">someStruct *temp = allocator(someStruct); <\/code><\/pre>\n<p>  \u0438\u043b\u0438  <\/p>\n<pre><code class=\"cpp\">someStruct *array = arrayAllocator(someStruct, 42); <\/code><\/pre>\n<h4>Null pointers<\/h4>\n<p>  \u0415\u0441\u043b\u0438 \u0434\u043e\u043b\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0421++, \u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u0441\u044f \u0432 \u0421, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0434\u043b\u044f \u0441\u0435\u0431\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e, \u0447\u0442\u043e \u0432 C \u043d\u0435\u0442\u0443 \u043e\u0431\u044c\u0435\u043a\u0442\u043d\u043e\u0433\u043e nullPtr, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0434\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. \u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0435 C \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e, \u0447\u0442\u043e null pointer \u2013 \u044d\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0438 \u043d\u0430 \u043a\u0430\u043a\u043e\u0439 \u043e\u0431\u044c\u0435\u043a\u0442 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435, \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043c\u0430\u043a\u0440\u043e<\/p>\n<pre><code class=\"cpp\"> #define NULL ((void*)0)  <\/code><\/pre>\n<p> \u2013 \u043a\u0430\u0441\u0442\u043e\u0432\u0430\u043d\u043e\u0439 \u043a \u0442\u0438\u043f\u0443 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b 0. \u042d\u0442\u043e \u0432 \u043b\u0443\u0447\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u0434\u0430\u0435\u0442 warning \u043e \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0442\u0438\u043f\u043e\u0432. \u0412\u0441\u0435\u0433\u0434\u0430 \u0447\u0438\u0442\u0430\u0439\u0442\u0435 warnings \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430, \u0435\u0441\u043b\u0438 \u0438\u0445 \u043d\u0435\u0442 \u2013 \u0445\u043e\u0440\u043e\u0448\u043e, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u043e\u0440\u0435\u043d\u044c \u0437\u043b\u0430. <br \/>  \u0418\u0437 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u0430\u0445\u0430\u0440\u0430, \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u043f\u0430\u0440\u0443 \u0448\u0442\u0443\u043a \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439:<\/p>\n<pre><code class=\"cpp\">typedef void*   pointer;  #define nil    ((pointer) 0) <\/code><\/pre>\n<p>  \u041f\u043e \u043c\u043e\u0435\u043c\u0443 pointer \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u0447\u0435\u043c void*.<\/p>\n<h4>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 NULL<\/h4>\n<p>  \u041e\u0431\u044b\u0447\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0448\u044c \u0432 \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0439 \u0441\u0444\u0435\u0440\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0441 exception, \u043d\u0435 \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u0435\u0448\u044c\u0441\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u0432\u043e\u043e\u0431\u0449\u0435. \u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 unix, \u0440\u0435\u0448\u0438\u043b\u0438, \u0447\u0442\u043e-\u0431\u044b \u043d\u0435 \u0443\u0431\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0446\u0435\u043b\u0438\u043a\u043e\u043c, \u043f\u0440\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c, \u043a\u0430\u043a \u043f\u0440\u043e\u0441\u044c\u0431\u0443 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c. \u0422\u043e \u0435\u0441\u0442\u044c malloc, calloc, realloc, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c (\u043d\u0443 \u043a\u043e\u043d\u0447\u0438\u043b\u0430\u0441\u044c \u043e\u0437\u0443, \u0447\u0442\u043e \u043f\u043e\u0434\u0435\u043b\u0430\u0442\u044c), \u0442\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 NULL (\u0430 \u044f \u0434\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c nil, \u0442.\u043a. \u043c\u043d\u0435 \u043e\u043d \u0431\u043e\u043b\u0435\u0435 \u043c\u0438\u043b)<\/p>\n<pre><code class=\"cpp\">int *array = arrayAllocator(int, 10); if(a != nil) { \tarray[9] = 9; \tdoSome(array); } else { \tsomeCleanup(); } <\/code><\/pre>\n<p>  \u0435\u0441\u043b\u0438 \u0436\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c (nil \u0442\u0430\u043a \u0436\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u043c) \u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 SIGSEGV, \u0438\u043b\u0438 \u0435\u0449\u0435 \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u0442\u0438\u043f\u0430 general protection fault. \u0418 \u0442\u043e\u0433\u0434\u0430 \u043f\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0430\u0434\u0430\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e. \u0415\u0441\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c nil, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u043f\u0435\u0442\u044c \u0437\u0430\u0434\u0430\u043c\u043f\u0438\u0442\u044c \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u044b\u0435 \u0434\u0430\u043d\u044b\u0435 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<h4>\u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432<\/h4>\n<p>  \u041e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438   <\/p>\n<pre><code class=\"cpp\">int *array = (int*)malloc(sizeof(int) * 10); <\/code><\/pre>\n<p>  \u0422\u0430\u043a \u0432\u043e\u0442, \u0442\u0430\u043c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u0442.\u043a. malloc \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u044b\u0440\u043e\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c(void*), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u0441\u0435\u0445 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439. \u041b\u044e\u0431\u043e\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0432 \u0421, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, int * \u2014 \u044d\u0442\u043e \u0442\u043e\u0442 \u0436\u0435 void* \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0439 \u043e\u0442\u043c\u0435\u0442\u043a\u043e\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430, \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f. \u041f\u0443\u0441\u0442\u044c \u0434\u0430\u0436\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 SomeStruct* \u2014 \u044d\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e 4-\u0445 \u0438\u043b\u0438 8-\u043c\u0438 \u0431\u0430\u0439\u0442\u043d\u044b\u0439 void*. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u0442\u0438\u043f\u043e\u0432(\u043a\u0430\u0441\u0442\u0438\u043d\u0433\u043e\u043c) \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0434\u043e \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u0438 \u043e\u043d \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0432\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u0435 \u0442\u0438\u043f\u044b \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0440\u0443\u0433 \u043a \u0434\u0440\u0443\u0433\u0443, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u043a\u0430\u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0433\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438. \u0415\u0441\u043b\u0438 \u0436\u0435 \u043e\u043d\u0430 \u0435\u0441\u0442\u044c \u2013 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0442\u0435\u0441\u044f direct cast, \u0442\u0438\u043f\u0430:<\/p>\n<pre><code class=\"cpp\">SomeStruct * arrayOfStructs  = (SomeStruct*)arrayOfInts; <\/code><\/pre>\n<p>  \u0418 \u0442\u043e\u0433\u0434\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0435 \u0432\u044b\u0434\u0430\u0441\u0442 \u0434\u0430\u0436\u0435 warning, \u0442.\u043a. \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0447\u0442\u043e \u0432\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u0432\u044b \u0434\u0435\u043b\u0430\u0435\u0442\u0435.<\/p>\n<h4>Memory management level advanced (custom allocators)<\/h4>\n<p>  \u041a\u0440\u0430\u0439\u043d\u0435 \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043b\u0435\u043d\u0438\u0432\u044b\u043c\u0438, \u0438 \u0437\u0430\u0431\u044b\u0432\u0430\u044e\u0442 \u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u044c, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b\u0438 \u043a\u0443\u0447\u0443 \u0438\u043d\u0442\u0441\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u0430\u043a reference counting, RAII, \u043d\u043e \u0432 C \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u0442\u0443, \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0430\u043b\u043b\u043e\u043a\u0430\u0442\u043e\u0440\u044b \u043f\u0430\u043c\u044f\u0442\u0438, \u0441 \u0443\u0441\u0438\u043b\u0435\u043d\u044b\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"http:\/\/apr.apache.org\/docs\/apr\/1.4\/group__apr__pools.html\">ARP Pool<\/a> \u0438\u043b\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/244617\/\">RPool<\/a>, \u0430 \u043d\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u043e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Address_Space_Layout_Randomization\">ASLR \u2013 \u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u044b<\/a> \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443, \u043d\u043e \u0432\u0441\u0435 \u0436\u0435 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043d\u0435\u0441\u0442\u0438 \u043a custom allocators. \u0412 openBSD, \u0438\u043b\u0438 OSX <a href=\"http:\/\/en.wikipedia.org\/wiki\/OpenBSD_security_features\">\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440<\/a>. <\/p>\n<h4>metaAlloc <\/h4>\n<p>  \u0415\u0449\u0435 \u043e\u0434\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 RPool (\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u0432 \u0441\u0441\u044b\u043b\u043a\u0435 \u0432\u044b\u0448\u0435) \u2013 metaAlloc \u2013 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0435\u0441\u0442\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0433\u0434\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c \u043d\u0435 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b.<\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440<\/p>\n<pre><code class=\"cpp\">enablePool(RPool);  Int *array = metaAlloc(arraySize(int, 10), \u201cArray for storing some indexes\u201d); double *somePointer = metaAlloc(arraySize(double, 1), &quot;Some double pointer&quot;);   printerOfRAutoPool(RPool);  deleter(RPool, RAutoPool); <\/code><\/pre>\n<p>  \u0412\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0430 \u0442\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0446\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u043e\u0439:<\/p>\n<pre><code class=\"css\">0 - 0x100104b00 [s: 8] (tuid: 149303) - Some double pointer 1 - 0x100105170 [s: 40] (tuid: 149303) - Int Array for storing some indexes <\/code><\/pre>\n<p>  \u0418 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0433\u0434\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u043d\u0435 \u043e\u0447\u0438\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u0430\u043c\u044f\u0442\u044c. \u0412 release \u043c\u043e\u0434\u0435, \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 (\u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f), \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0444\u043b\u0430\u0433, \u0438 metaAlloc \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 malloc. <\/p>\n<h4>\u0412\u044b\u0432\u043e\u0434\u044b<\/h4>\n<p>  \u0412\u0441\u0435\u0433\u0434\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u0438 \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0430 \u0432 \u0431\u0430\u0439\u0442\u0430\u0445. \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0440\u0430\u0449\u0430\u0435\u0442 realloc. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043d\u0430 NULL. \u0415\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u2013 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0430\u043b\u043b\u043e\u043a\u0430\u0442\u043e\u0440\u044b \u0438\u043b\u0438 \u0447\u0435\u043a\u0435\u0440\u044b.<\/p>\n<p>  P.S. \u041d\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u044e \u043d\u0430 \u0433\u0435\u043d\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439. \u0415\u0441\u043b\u0438 \u0443 \u043a\u043e\u0433\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438\u043b\u0438 \u0438\u0434\u0435\u0438 \u043f\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e RPool, \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u043f\u043e\u043c\u043e\u0447\u044c, \u0447\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043c\u043e\u0433\u0443.     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/256743\/\"> http:\/\/habrahabr.ru\/post\/256743\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/3de\/ad6\/ea6\/3dead6ea6bbc15fba92c714026017a76.png\" alt=\"image\"\/><\/p>\n<pre><code class=\"cpp\">++recoveryModePublicationCount; \/\/ \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0443\u0436\u0435 n-\u0439 \u0440\u0430\u0437 <\/code><\/pre>\n<p>  \u0414\u043e\u0440\u043e\u0433\u043e\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u0435\u0441\u043b\u0438 \u0442\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0448\u044c \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0421 (\u043d\u0435 \u0421++) \u0438\u043b\u0438 \u0445\u043e\u0447\u0435\u0448\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u043d\u0438\u044f (\u0438\u0437 \u0443\u0440\u043e\u0432\u043d\u044f \u043f\u0440\u043e\u043f\u0438\u0441\u043d\u044b\u0445 \u0438\u0441\u0442\u0438\u043d) \u0442\u043e\u0433\u0434\u0430 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043b\u0438\u0448\u0438\u0442 \u0442\u0435\u0431\u044f \u0441\u0447\u0430\u0441\u0442\u044c\u044f \u043f\u0440\u043e\u0441\u0442\u0440\u0435\u043b\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u043d\u043e\u0433\u0443 \u043f\u0430\u0440\u0443 \u0440\u0430\u0437 \u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439.<\/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-256121","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/256121","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=256121"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/256121\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=256121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=256121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=256121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}