{"id":310721,"date":"2020-09-30T09:01:31","date_gmt":"2020-09-30T09:01:31","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=310721"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=310721","title":{"rendered":"C++: \u041a\u043e\u0432\u0430\u0440\u0441\u0442\u0432\u043e \u0438 \u041b\u044e\u0431\u043e\u0432\u044c, \u0438\u043b\u0438 \u0414\u0430 \u0447\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0439\u0442\u0438 \u043d\u0435 \u0442\u0430\u043a?"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/simbirsoft\/blog\/521018\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/x8\/bd\/cl\/x8bdcla3jusety8mujrcdbdri3m.png\"><\/p>\n<blockquote><p>\u201cC \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0432 \u043d\u043e\u0433\u0443. \u041d\u0430 C++ \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u043d\u043e \u043d\u043e\u0433\u0443 \u043e\u0442\u043e\u0440\u0432\u0451\u0442 \u0446\u0435\u043b\u0438\u043a\u043e\u043c\u201d \u2014 \u0411\u044c\u0451\u0440\u043d \u0421\u0442\u0440\u0430\u0443\u0441\u0442\u0440\u0443\u043f, \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u044c C++.<\/p><\/blockquote>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u043e\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439, \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0438 \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0433\u043a\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0435\u0433\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u043f\u0440\u0435\u0434\u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u043e\u043c\u0430\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0438\u0441\u044c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u0438 \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/pd\/gc\/an\/pdgcaneemmqwaeeo1otp-6k5bl0.png\"><a name=\"habracut\"><\/a><\/p>\n<p>  \u041c\u044b \u0432 SimbirSoft \u0442\u0435\u0441\u043d\u043e \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u0447\u0430\u0435\u043c \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c <a href=\"https:\/\/securecodewarrior.com\/\">Secure Code Warrior<\/a>, \u043e\u0431\u0443\u0447\u0430\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0421\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0425\u0430\u0431\u0440\u0430 \u043c\u044b \u043f\u0435\u0440\u0435\u0432\u0435\u043b\u0438 <a href=\"https:\/\/www.codeproject.com\/Articles\/5164537\/Dark-corners-and-pitfalls-of-Cplusplus\">\u0441\u0442\u0430\u0442\u044c\u044e<\/a>, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u043d\u0430\u0448\u0438\u043c \u0430\u0432\u0442\u043e\u0440\u043e\u043c \u0434\u043b\u044f \u043f\u043e\u0440\u0442\u0430\u043b\u0430 CodeProject.com.<\/p>\n<h2>\u0418\u0442\u0430\u043a, \u043a \u043a\u043e\u0434\u0443!<\/h2>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0430 C++. \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0431\u044b\u043b \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0441 \u0446\u0435\u043b\u044c\u044e \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0432\u0441\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0438 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u0432\u043f\u043e\u043b\u043d\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445. \u041a\u0430\u043a \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u044d\u0442\u043e \u043a\u043e\u0434 \u0438\u0437 <b>Windows DLL<\/b> (\u044d\u0442\u043e \u0432\u0430\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442). \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043a\u0442\u043e-\u0442\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0432 \u043d\u0435\u043a\u043e\u0435\u043c (\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u043c, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f) \u0440\u0435\u0448\u0435\u043d\u0438\u0438.<\/p>\n<p>  \u041f\u0440\u0438\u0433\u043b\u044f\u0434\u0438\u0442\u0435\u0441\u044c \u043a \u043a\u043e\u0434\u0443. \u0427\u0442\u043e, \u043d\u0430 \u0432\u0430\u0448 \u0432\u0437\u0433\u043b\u044f\u0434, \u0432 \u043d\u0451\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0439\u0442\u0438 \u043d\u0435 \u0442\u0430\u043a?<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u0434<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">class Finalizer {     struct Data     {         int i = 0;         char* c = nullptr;                  union U         {             long double d;                          int i[sizeof(d) \/ sizeof(int)];                          char c [sizeof(i)];         } u = {};                  time_t time;     };          struct DataNew;     DataNew* data2 = nullptr;          typedef DataNew* (*SpawnDataNewFunc)();     SpawnDataNewFunc spawnDataNewFunc = nullptr;          typedef Data* (*Func)();     Func func = nullptr;          Finalizer()     {         func = GetProcAddress(OTHER_LIB, &quot;func&quot;)                  auto data = func();                  auto str = data-&gt;c;                  memset(str, 0, sizeof(str));                  data-&gt;u.d = 123456.789;                  const int i0 = data-&gt;u.i[sizeof(long double) - 1U];                  spawnDataNewFunc = GetProcAddress(OTHER_LIB, &quot;SpawnDataNewFunc&quot;)         data2 = spawnDataNewFunc();     }          ~Finalizer()     {         auto data = func();                  delete[] data2;     } };  Finalizer FINALIZER;  HMODULE OTHER_LIB; std::vector&lt;int&gt;* INTEGERS;  DWORD WINAPI Init(LPVOID lpParam) {     OleInitialize(nullptr);          ExitThread(0U); }  BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {     static std::vector&lt;std::thread::id&gt; THREADS;          switch (fdwReason)     {         case DLL_PROCESS_ATTACH:             CoInitializeEx(nullptr, COINIT_MULTITHREADED);                          srand(time(nullptr));                          OTHER_LIB = LoadLibrary(&quot;B.dll&quot;);                          if (OTHER_LIB = nullptr)                 return FALSE;                          CreateThread(nullptr, 0U, &amp;Init, nullptr, 0U, nullptr);         break;                  case DLL_PROCESS_DETACH:             CoUninitialize();                          OleUninitialize();             {                 free(INTEGERS);                                  const BOOL result = FreeLibrary(OTHER_LIB);                                  if (!result)                     throw new std::runtime_error(&quot;Required module was not loaded&quot;);                                  return result;             }         break;                  case DLL_THREAD_ATTACH:             THREADS.push_back(std::this_thread::get_id());         break;                  case DLL_THREAD_DETACH:             THREADS.pop_back();         break;     }     return TRUE; }  __declspec(dllexport) int Initialize(std::vector&lt;int&gt; integers, int&amp; c) throw() {     for (int i : integers)         i *= c;          INTEGERS = new std::vector&lt;int&gt;(integers); }  int Random() {     return rand() + rand(); }  __declspec(dllexport) long long int __cdecl _GetInt(int a) {     return 100 \/ a &lt;= 0 ? a : a + 1 + Random(); }<\/code><\/pre>\n<p>  <\/div>\n<\/p><\/div>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u0441\u043e\u0447\u043b\u0438 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u0440\u043e\u0441\u0442\u044b\u043c, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c \u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c? \u0418\u043b\u0438, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u0432\u044b \u043d\u0430\u0448\u043b\u0438 \u0432 \u043d\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b? \u0410 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u0434\u0430\u0436\u0435 \u0434\u044e\u0436\u0438\u043d\u0443 \u0438\u043b\u0438 \u0434\u0432\u0435?<\/p>\n<p>  \u0427\u0442\u043e \u0436, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0432 \u044d\u0442\u043e\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 <b>\u0431\u043e\u043b\u0435\u0435 43 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0433\u0440\u043e\u0437<\/b> \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0437\u043d\u0430\u0447\u0438\u043c\u043e\u0441\u0442\u0438!<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ux\/m1\/vz\/uxm1vzhaec-dtfutyh8kodrxymo.png\"><\/p>\n<h3>\u041d\u0430 \u0447\u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u0432\u0441\u0451 \u0436\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435<\/h3>\n<p>  1) sizeof(d) (\u0433\u0434\u0435 d \u2014 \u044d\u0442\u043e long double) \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u0440\u0430\u0442\u0435\u043d sizeof(int)<\/p>\n<pre><code class=\"cpp\">int i[sizeof(d) \/ sizeof(int)];<\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0438 \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0434\u0435\u0441\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0430\u0437\u043c\u0435\u0440 long double \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c 10 \u0431\u0430\u0439\u0442 \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445 (\u0447\u0442\u043e \u043d\u0435\u0432\u0435\u0440\u043d\u043e \u0434\u043b\u044f <b>\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 MS VS<\/b>, \u043d\u043e \u0432\u0435\u0440\u043d\u043e \u0434\u043b\u044f <b>RAD Studio<\/b>, \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u043a\u0430\u043a <b>C++ Builder<\/b>).<\/p>\n<p>  <a href=\"https:\/\/www.viva64.com\/en\/t\/0012\">int \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b<\/a> (\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u043a\u043e\u0434 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f <b>Windows<\/b>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u043a \u044d\u0442\u043e\u0439 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0434\u0443\u043c\u0430\u043d\u043d\u0430\u044f, \u043d\u043e \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0442\u0430\u043a\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432\u0435\u0441\u044c\u043c\u0430 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430).<\/p>\n<p>  \u0412\u0441\u0435 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Type_punning\">\u043a\u0430\u043b\u0430\u043c\u0431\u0443\u0440 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438<\/a>. \u041a \u0441\u043b\u043e\u0432\u0443, \u043e\u043d <a href=\"https:\/\/adriann.github.io\/undefined_behavior.html\">\u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/a> \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 \u044f\u0437\u044b\u043a\u0430 C++. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u043b\u0430\u043c\u0431\u0443\u0440\u0430 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <a href=\"https:\/\/www.cocoawithlove.com\/2008\/04\/using-pointers-to-recast-in-c-is-bad.html\">\u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439<\/a>, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 <a href=\"https:\/\/blog.regehr.org\/archives\/959\">\u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \u043e\u0431\u044b\u0447\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435, \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f<\/a> (\u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 <a href=\"https:\/\/www.ibm.com\/support\/knowledgecenter\/en\/SSB23S_1.1.0.14\/common\/m1rhpun.html\"><b>GCC<\/b><\/a>).<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/bp\/bi\/bg\/bpbibgtermaktehsbatl6uhc5ne.png\"> <\/p>\n<p>  <a href=\"https:\/\/medium.com\/@CPP_Coder\/about-size-t-and-ptrdiff-t-a1654234d842\"><i>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a: Medium.com<\/i><\/a><\/p>\n<p>  \u041c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0447\u0438\u043c, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 C++, <a href=\"https:\/\/stackoverflow.com\/questions\/11639947\/is-type-punning-through-a-union-unspecified-in-c99-and-has-it-become-specified\">\u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c C \u043a\u0430\u043b\u0430\u043c\u0431\u0443\u0440 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c<\/a> (\u0432\u044b \u0436\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0435, \u0447\u0442\u043e <i><a href=\"https:\/\/hackr.io\/blog\/c-vs-cpp\">C++ \u0438 C \u2013 \u0440\u0430\u0437\u043d\u044b\u0435 \u044f\u0437\u044b\u043a\u0438<\/a><\/i>, \u0438 \u0432\u044b <b>\u043d\u0435<\/b> \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0436\u0438\u0434\u0430\u0442\u044c, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442\u0435 \u0437\u043d\u0430\u0442\u044c C, \u0435\u0441\u043b\u0438 \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 C++, \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u043d\u0435 \u0442\u0430\u043a \u043b\u0438?)<\/p>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435: <\/b>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/keyword\/static_assert\">static_assert<\/a> \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. \u041e\u043d \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0434\u0438\u0442 \u0432\u0430\u0441, \u0435\u0441\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u0447\u0442\u043e-\u0442\u043e \u0441 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u043c\u0438 \u0442\u0438\u043f\u043e\u0432 \u043f\u043e\u0439\u0434\u0435\u0442 \u043d\u0435 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">static_assert(0U == (sizeof(d) % sizeof(int)), \u201cHouston, we have a problem\u201d);<\/code><\/pre>\n<p>  2) time_t \u2014 \u044d\u0442\u043e \u043c\u0430\u043a\u0440\u043e\u0441, \u0432 Visual Studio \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f \u043d\u0430 32-\u0431\u0438\u0442\u043d\u044b\u0439 (\u0441\u0442\u0430\u0440\u044b\u0439) \u0438\u043b\u0438 64-\u0431\u0438\u0442\u043d\u044b\u0439 (\u043d\u043e\u0432\u044b\u0439) \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0439 \u0442\u0438\u043f<\/p>\n<pre><code class=\"cpp\">time_t time;<\/code><\/pre>\n<p>  \u0414\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u044d\u0442\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 DLL, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u043d \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442) \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0447\u0442\u0435\u043d\u0438\u044e\/\u0437\u0430\u043f\u0438\u0441\u0438 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u044d\u0442\u0438 \u0434\u0432\u0430 \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044f \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0441 \u0440\u0430\u0437\u043d\u044b\u043c \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u044d\u0442\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u0427\u0442\u043e, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044e \u043f\u0430\u043c\u044f\u0442\u0438 \u0438\u043b\u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044e \u043c\u0443\u0441\u043e\u0440\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/a1\/4o\/ew\/a14oewfipxcuerzog4xoy-fg_oo.png\"><\/p>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/b> \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0432\u0441\u0435\u043c\u0438 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b \u0441\u0442\u0440\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430:<\/p>\n<pre><code class=\"cpp\">int64_t time;<\/code><\/pre>\n<p>  3) <b>B.dll<\/b> (\u0445\u044d\u043d\u0434\u043b \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u0440\u0430\u043d\u0438\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <b>OTHER_LIB<\/b>) \u0435\u0449\u0435 <b>\u043d\u0435<\/b> \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0430\u0434\u0440\u0435\u0441\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u0430\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/p>\n<p>  4) \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u043c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (<a href=\"https:\/\/isocpp.org\/wiki\/faq\/ctors#static-init-order\">SIOF<\/a>): (\u043e\u0431\u044a\u0435\u043a\u0442 <b>OTHER_LIB<\/b> \u0432 \u043a\u043e\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u043e\u043d \u0431\u044b\u043b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d) <\/p>\n<pre><code class=\"cpp\">func = GetProcAddress(OTHER_LIB, &quot;func&quot;);<\/code><\/pre>\n<p>  <b>FINALIZER<\/b> \u2014 \u044d\u0442\u043e <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/keyword\/static\">\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439<\/a> \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>DllMain<\/b>. \u0412 \u0435\u0433\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u043c\u044b \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0443\u0441\u0443\u0433\u0443\u0431\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 <b>OTHER_LIB<\/b>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c <b>FINALIZER<\/b>, \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0435\u0434\u0438\u043d\u0438\u0446\u0435 \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438 \u043d\u0438\u0436\u0435 \u043f\u043e \u043a\u043e\u0434\u0443. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d (\u043e\u0431\u043d\u0443\u043b\u0435\u043d) \u043e\u043d \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0437\u0436\u0435. \u0422. \u0435. \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043a \u043d\u0435\u043c\u0443 \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Pseudorandomness\">\u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439<\/a> \u043c\u0443\u0441\u043e\u0440. <b>WinAPI<\/b> \u0432 \u0446\u0435\u043b\u043e\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u044d\u0442\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u044c\u044e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0441 \u0442\u0430\u043a\u0438\u043c \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0432\u0441\u0435. \u0418 \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0438 \u043e\u043d \u0432\u0441\u0451 \u0442\u0430\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u2014 \u0432\u0440\u044f\u0434 \u043b\u0438 \u0432 \u043d\u0451\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e \u0438\u043c\u0435\u043d\u0438 <i>\u00abFunc\u00bb<\/i>.<\/p>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/b> \u043e\u0431\u0449\u0438\u0439 \u0441\u043e\u0432\u0435\u0442 \u2014 \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u0445, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432 <b>DLL<\/b>. \u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0432\u0441\u0435 \u0436\u0435 \u043d\u0443\u0436\u043d\u044b \u0432\u0430\u043c \u043f\u043e \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435, \u0431\u0443\u0434\u044c\u0442\u0435 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b \u0438 \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u044b \u0441 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u043c \u0438\u0445 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0427\u0442\u043e\u0431\u044b <a href=\"https:\/\/isocpp.org\/wiki\/faq\/ctors#static-init-order-on-first-use\">\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u043e\u0440\u044f\u0434\u043e\u043a<\/a>, \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u0435 <b>\u0432\u0441\u0435<\/b> \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f) \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 <b>\u043e\u0434\u043d\u0443<\/b> <a href=\"https:\/\/en.wikipedia.org\/wiki\/Translation_unit_(programming)\">\u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438<\/a> \u0432 \u043d\u0443\u0436\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0438\u0445 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0443\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e.<\/p>\n<p>  5) \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u043d\u0435\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <\/p>\n<pre><code class=\"cpp\">auto data = func();<\/code><\/pre>\n<p>  func \u2014 \u044d\u0442\u043e <a href=\"https:\/\/en.wikipedia.org\/wiki\/Function_pointer\">\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e<\/a>. \u0418 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u0437 <b>B.dll<\/b>. \u041e\u0434\u043d\u0430\u043a\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u043b\u0438 \u0432\u0441\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0448\u0430\u0433\u0435, \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 <b>nullptr<\/b>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u044b\u0442\u0430\u044f\u0441\u044c \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e, \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043e\u0448\u0438\u0431\u043a\u0443 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 (access violation) \u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0443 \u0437\u0430\u0449\u0438\u0442\u044b \u043f\u0430\u043c\u044f\u0442\u0438 (general protection fault) \u0438\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u0434\u0443\u0445\u0435.<\/p>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/b> \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u043a\u043e\u0434\u043e\u043c (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 <b>WinAPI<\/b>) <b>\u0432\u0441\u0435\u0433\u0434\u0430 <\/b>\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0439\u0442\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0414\u043b\u044f \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0445 \u0438 \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u0430\u0436\u0435 \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0442\u0440\u043e\u0433\u0438\u0439 \u0434\u043e\u0433\u043e\u0432\u043e\u0440 [\u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0438 \u0432 \u043a\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c].<\/p>\n<p>  6) \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435\/\u0437\u0430\u043f\u0438\u0441\u044c \u043c\u0443\u0441\u043e\u0440\u0430 \u043f\u0440\u0438 \u043e\u0431\u043c\u0435\u043d\u0435 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438, \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 alignment\/padding \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 <\/p>\n<pre><code class=\"cpp\">auto str = data-&gt;c;<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 Data (\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438) \u0438\u043c\u0435\u0435\u0442 \u0432 \u044d\u0442\u0438\u0445 \u0441\u0430\u043c\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044f\u0445 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u043e\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0432\u0441\u0435 \u0432\u044b\u043b\u044c\u0435\u0442\u0441\u044f \u0432 \u0440\u0430\u043d\u0435\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u0435 <a href=\"https:\/\/www.viva64.com\/en\/t\/0063\">\u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/General_protection_fault\">\u043e\u0448\u0438\u0431\u043a\u0443 \u0437\u0430\u0449\u0438\u0442\u044b \u043f\u0430\u043c\u044f\u0442\u0438<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Segmentation_fault\">\u043e\u0448\u0438\u0431\u043a\u0443 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>, <a href=\"http:\/\/www.qnx.com\/developers\/docs\/qnxcar2\/index.jsp?topic=%2Fcom.qnx.doc.neutrino.prog%2Ftopic%2Fhat_ProblemsWithHeapCorruption.html\">\u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u043a\u0443\u0447\u0438<\/a> \u0438 \u0442.\u0434. \u0418\u043b\u0438 \u0436\u0435 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043c\u0443\u0441\u043e\u0440. \u0422\u043e\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. \u0412\u0441\u0435 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u044f\u0432\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Data_structure_alignment\">\u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u044f\/\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/a>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u044d\u0442\u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0431\u044b\u043b\u0438 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qs\/-l\/re\/qs-lrez2ocx5i2_iobstipeuyfs.png\"><\/p>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435: <\/b>\u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0432\u0441\u0435 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043c\u0435\u044e\u0442 \u0441\u0442\u0440\u043e\u0433\u043e\u0435, \u044f\u0432\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0438 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0442\u0438\u043f\u044b \u0441 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c, \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435 \u0438 \u0442.\u0434.) \u0438\/\u0438\u043b\u0438 \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438, \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439, \u0431\u044b\u043b\u0438 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u044f\/\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0442\u0430\u043a\u0436\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\"><a href=\"https:\/\/docs.microsoft.com\/en-us\/cpp\/cpp\/alignment-cpp-declarations?view=vs-2019\">Alignment (C++ Declarations)<\/a><br \/>  <a href=\"https:\/\/en.wikipedia.org\/wiki\/Data_structure_alignment\">Data structure alignment<\/a><br \/>  <a href=\"https:\/\/stackoverflow.com\/questions\/5397447\/struct-padding-in-c\">Struct padding in C++<\/a>  <\/div>\n<\/p><\/div>\n<p>  7) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u043c\u0435\u0441\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0441\u0430\u043c\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430<\/p>\n<pre><code class=\"cpp\">memset(str, 0, sizeof(str));<\/code><\/pre>\n<p>  \u041e\u0431\u044b\u0447\u043d\u043e \u0442\u0430\u043a\u043e\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0438. \u041d\u043e \u0442\u0430\u043a\u0436\u0435 \u044d\u0442\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u043c\u0435\u0442\u044c \u0434\u0435\u043b\u043e \u0441\u043e <a href=\"https:\/\/en.wikipedia.org\/wiki\/Template_metaprogramming#Static_polymorphism\">\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u043e\u043c<\/a> \u0438\u043b\u0438 \u043f\u0440\u0438 \u0431\u0435\u0437\u0434\u0443\u043c\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 auto (<a href=\"https:\/\/www.acodersjourney.com\/c-11-auto\">\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u0438\u043c \u044f\u0432\u043d\u043e \u0437\u043b\u043e\u0443\u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044e\u0442<\/a>). \u041e\u0447\u0435\u043d\u044c \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043d\u0430\u0434\u0435\u044f\u0442\u044c\u0441\u044f, \u0432\u043f\u0440\u043e\u0447\u0435\u043c, \u0447\u0442\u043e \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u043c\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Static_program_analysis\">\u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430<\/a>.<\/p>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/b><br \/>   \u2014 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u0443\u0442\u0430\u0439\u0442\u0435 sizeof (<i>&lt;\u043f\u043e\u043b\u043d\u044b\u0439 \u0442\u0438\u043f \u043e\u0431\u044a\u0435\u043a\u0442\u0430&gt;<\/i>) \u0438 sizeof (<i>&lt;\u0442\u0438\u043f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442&gt; <\/i>);<br \/>   \u2014 <a href=\"https:\/\/wiki.sei.cmu.edu\/confluence\/display\/c\/MSC00-C.+Compile+cleanly+at+high+warning+levels\">\u043d\u0435 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0439\u0442\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430<\/a>;<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hp\/sr\/em\/hpsrem4_ezc9p-ptw0x9ijal0hu.png\"><\/p>\n<p>   \u2014 \u0432\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0439 \u043c\u0430\u0433\u0438\u0438 \u0421++, \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u0443\u044f typeid, constexpr \u0438 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/language\/static_assert\">static_assert<\/a>, \u0447\u0442\u043e\u0431\u044b \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0442\u0438\u043f\u043e\u0432 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 (\u0437\u0434\u0435\u0441\u044c \u0435\u0449\u0451 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/types#Type_traits_.28since_C.2B.2B11.29\">type traits<\/a>, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/types\/is_pointer\">std::is_pointer<\/a>).<\/p>\n<p>  8) \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0447\u0438\u0442\u0430\u0442\u044c \u0438\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u043d\u0435\u0436\u0435\u043b\u0438 \u0442\u043e, \u0447\u0442\u043e \u0440\u0430\u043d\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/p>\n<p>  9) \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0447\u0442\u0435\u043d\u0438\u044f \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440 long double \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u043c\u0438 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438<\/p>\n<pre><code class=\"cpp\">const int i0 = data-&gt;u.i[sizeof(long double) - 1U];<\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e \u0440\u0430\u043d\u0435\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u0442\u043e\u0447\u043a\u0443 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0440\u0430\u043d\u0435\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/b> \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043f\u043e\u043b\u044e, \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b\u043b\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0440\u0430\u043d\u0435\u0435, \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u0432\u0430\u0448 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0442\u0438\u043f\u043e\u0432 \u043e\u0431\u0449\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b \u0432\u043e \u0432\u0441\u0435\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u044f\u0445.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0442\u0430\u043a\u0436\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\"><a href=\"https:\/\/blog.qt.io\/blog\/2011\/06\/10\/type-punning-and-strict-aliasing\/\">Type-punning and strict-aliasing<\/a><br \/>  <a href=\"https:\/\/gist.github.com\/shafik\/848ae25ee209f698763cffee272a58f8\">What is the Strict Aliasing Rule and Why do we care?<\/a>  <\/div>\n<\/p><\/div>\n<p>  10) \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 B.dll \u0431\u044b\u043b\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u00abfunc\u00bb \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430, B.dll \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0443\u0436\u0435 \u0432\u044b\u0433\u0440\u0443\u0436\u0435\u043d\u0430 \u0438\u0437 \u043f\u0430\u043c\u044f\u0442\u0438 \u043a \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443 (\u0442. \u043a. \u0440\u0430\u043d\u0435\u0435 \u0431\u044b\u043b\u0430 \u0432\u044b\u0437\u0432\u0430\u043d\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 FreeLibrary \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 DLL_PROCESS_DETACH \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 DllMain) <\/p>\n<pre><code class=\"cpp\">auto data = func();<\/code><\/pre>\n<p>  \u0412\u044b\u0437\u043e\u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0443 \u0443\u0436\u0435 \u0440\u0430\u0437\u0440\u0443\u0448\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u043d\u0435\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u0440\u0430\u0432\u043d\u043e \u043a\u0430\u043a \u0438 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u0436\u0435 \u0432\u044b\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0439 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a <a href=\"https:\/\/support.microsoft.com\/en-us\/help\/125749\/description-of-the-r6025-run-time-error-in-visual-c\">\u043e\u0448\u0438\u0431\u043a\u0435 \u0447\u0438\u0441\u0442\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430<\/a>.<\/p>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/b> \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0443\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u0444\u0438\u043d\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0443\u044e, \u0447\u0442\u043e \u0432\u0441\u0435 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0442 \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443\/\u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0433\u0440\u0443\u0436\u0435\u043d\u044b \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435. \u0418\u0437\u0431\u0435\u0433\u0430\u0439\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u0432 <b>DL<\/b>L. \u0418\u0437\u0431\u0435\u0433\u0430\u0439\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 DllMain\/DLL_PROCESS_DETACH (\u043a\u043e\u0433\u0434\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u0442 \u043a \u0441\u0432\u043e\u0435\u043c\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c\u0443 \u044d\u0442\u0430\u043f\u0443 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u2014 \u0444\u0430\u0437\u0435 \u0440\u0430\u0437\u0440\u0443\u0448\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0438\u0445 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432).<\/p>\n<h4>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0447\u0442\u043e \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b DLL:<\/h4>\n<p>  <b>\u0410) \u0421\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 LoadLibrary \u0441 \u0446\u0435\u043b\u044c\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443<\/b><\/p>\n<ul>\n<li>\u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 (\u044d\u0442\u043e\u0442 \u044d\u0442\u0430\u043f \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438)<\/li>\n<li>\u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 DllMain -&gt; DLL_PROCESS_ATTACH (\u0441\u0435\u043a\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438)<\/li>\n<li>\u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0447\u0430\u0442\u044c [\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e] \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c DllMain -&gt; DLL_THREAD_ATTACH \/ DLL_THREAD_DETACH (\u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043d\u043e \u0441\u043c. \u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u044f \u0432 \u043f\u0443\u043d\u043a\u0442\u0435 30).<\/li>\n<li>\u044d\u0442\u0438 \u0441\u0435\u043a\u0446\u0438\u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430), \u043d\u043e \u0431\u0443\u0434\u044c\u0442\u0435 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u044b<\/li>\n<li>\u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 (\u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0432\u0441\u044e \u0441\u043b\u043e\u0436\u043d\u0443\u044e\/\u0442\u044f\u0436\u0435\u043b\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0442\u0435\u043c, \u043a\u0442\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443)<\/li>\n<li>\u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439, \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043e\u043d\u0430 (\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430) \u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0430\u0441\u044c<\/li>\n<li> \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0414\u0415\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 (\u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0432\u0441\u044e \u0441\u043b\u043e\u0436\u043d\u0443\u044e\/\u0442\u044f\u0436\u0435\u043b\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u043e \u0414\u0415\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0442\u0435\u043c, \u043a\u0442\u043e \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443)<\/li>\n<li>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0438\u0437\u0431\u0435\u0433\u0430\u0439\u0442\u0435 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435: \u0432\u0441\u0435 \u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u044b, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0438\u0437 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/li>\n<\/ul>\n<p>  <b>\u0412) \u0414\u0440\u0443\u0433\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 FreeLibrary <\/b><\/p>\n<ul>\n<li>\u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 DllMain -&gt; DLL_PROCESS_DETACH (\u0441\u0435\u043a\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438) <\/li>\n<li>\u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 (\u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438) <\/li>\n<\/ul>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/_z\/gj\/az\/_zgjazwywbrnkunizqsswk64f0w.jpeg\"><\/p>\n<p>  11) <a href=\"https:\/\/en.wikipedia.org\/wiki\/Opaque_pointer\">\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f<\/a> (<a href=\"https:\/\/manu343726.github.io\/2016-03-07-c++11-opaque-pointer-idiom\">\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u043d\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u0442\u0438\u043f<\/a>, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e opaque pointer \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0443\u0442\u0435\u0447\u043a\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c) <\/p>\n<p>  12) \u0435\u0441\u043b\u0438 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 DataNew \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c, <a href=\"https:\/\/www.codeproject.com\/Articles\/28969\/HowTo-Export-C-classes-from-a-DLL\">\u0434\u0430\u0436\u0435 \u043f\u0440\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435 \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0435 \u043a\u043b\u0430\u0441\u0441\u0430<\/a> \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u043f\u043e\u043b\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043d\u0435\u043c, \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0432\u044b\u0437\u043e\u0432 \u0435\u0433\u043e \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u043d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u2014 \u044d\u0442\u043e, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a <a href=\"https:\/\/support.microsoft.com\/en-us\/help\/125749\/description-of-the-r6025-run-time-error-in-visual-c\">\u0447\u0438\u0441\u0442\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0432\u044b\u0437\u043e\u0432\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/a> (\u0442\u0430\u043a \u043a\u0430\u043a \u0442\u0438\u043f DataNew \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0437 \u0443\u0436\u0435 \u0432\u044b\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0433\u043e <b>\u0444\u0430\u0439\u043b\u0430 B.dll<\/b>). \u042d\u0442\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c.<\/p>\n<p>  13) \u0435\u0441\u043b\u0438 \u043a\u043b\u0430\u0441\u0441 DataNew \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/language\/abstract_class\">\u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u043c \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u043d\u044b\u043c \u0442\u0438\u043f\u043e\u043c<\/a>, \u0430 \u0435\u0433\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0438\u043c\u0435\u0435\u0442 \u0447\u0438\u0441\u0442\u044b\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0431\u0435\u0437 \u0442\u0435\u043b\u0430, \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 <a href=\"https:\/\/www.geeksforgeeks.org\/pure-virtual-destructor-c\">\u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 <\/a>\u0447\u0438\u0441\u0442\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>  14) \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u0435\u0441\u043b\u0438 \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c \u0447\u0435\u0440\u0435\u0437 new \u0438 \u0443\u0434\u0430\u043b\u044f\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f delete[]<\/p>\n<pre><code class=\"cpp\">delete[] data2;<\/code><\/pre>\n<p>  \u0412 \u0446\u0435\u043b\u043e\u043c, \u0432\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c <a href=\"https:\/\/eli.thegreenplace.net\/2011\/09\/16\/exporting-c-classes-from-a-dll\">\u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u044b<\/a> \u043f\u0440\u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043e\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439.<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <a href=\"https:\/\/stackoverflow.com\/questions\/1931126\/is-it-good-practice-to-null-a-pointer-after-deleting-it\">\u043e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439<\/a> \u043d\u0430 \u0440\u0430\u0437\u0440\u0443\u0448\u0435\u043d\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b.<\/p>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/b><br \/>   \u2014 \u043f\u0440\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d \u0435\u0433\u043e \u043f\u043e\u043b\u043d\u044b\u0439 \u0442\u0438\u043f<br \/>   \u2014 \u0432\u0441\u0435 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u0442\u0435\u043b\u043e<br \/>   \u2014 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u0434, \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0440\u0430\u043d\u043e<br \/>   \u2014 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b new \u0438 delete, \u043d\u0435 \u043f\u0443\u0442\u0430\u0442\u044c \u0438\u0445<br \/>   \u2014 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0431\u043d\u0443\u043b\u044f\u0442\u044c\u0441\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yd\/aw\/6c\/ydaw6cum9q7btlxeaodzqka3sne.png\"><\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<br \/>   \u2014 \u0432\u044b\u0437\u043e\u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 delete \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 void <a href=\"https:\/\/www.viva64.com\/en\/w\/v772\/\">\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442<\/a> \u043a \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e<br \/>  \u0447\u0438\u0441\u0442\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <a href=\"https:\/\/scc.ustc.edu.cn\/zlsc\/sugon\/intel\/ssadiag_docs\/index.htm#pt_reference\/references\/sc_cpp_pure_virtual_call_in_ctor.htm\">\u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b<\/a> \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430<br \/>   \u2014 \u0432\u044b\u0437\u043e\u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 <a href=\"https:\/\/wiki.sei.cmu.edu\/confluence\/display\/cplusplus\/OOP50-CPP.+Do+not+invoke+virtual+functions+from+constructors+or+destructors\">\u043d\u0435 \u0431\u0443\u0434\u0435\u0442<\/a> \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c<br \/>   \u2014 \u0441\u0442\u0430\u0440\u0430\u0439\u0442\u0435\u0441\u044c \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c <a href=\"https:\/\/www.fluentcpp.com\/2018\/04\/01\/cpp-will-no-longer-have-pointers\">\u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u044c\u044e<\/a> \u2014 \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 <a href=\"http:\/\/www.cplusplus.com\/reference\/stl\">\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b<\/a>, <a href=\"https:\/\/www.internalpointers.com\/post\/c-rvalue-references-and-move-semantics-beginners\">\u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u044f<\/a> \u0438<a href=\"https:\/\/en.wikipedia.org\/wiki\/Smart_pointer\"> \u0443\u043c\u043d\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438<\/a><\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0442\u0430\u043a\u0436\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\"><a href=\"https:\/\/stackoverflow.com\/questions\/1504251\/heap-corruption-what-could-the-cause-be\">Heap corruption: What could the cause be?<\/a>  <\/div>\n<\/p><\/div>\n<p>  15) ExitThread \u2014 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u0430 \u0432 C. \u0412 C++ \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0442\u043e\u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f \u0434\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 (\u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u0447\u0438\u0441\u0442\u043a\u0438), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 \u0432 C++ \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0443\u0442\u0435\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0442\u043e\u043a\u0430<\/p>\n<pre><code class=\"cpp\">ExitThread(0U); <\/code><\/pre>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435: <\/b>\u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 C++ \u043a\u043e\u0434\u0435.<\/p>\n<p>  16) \u0432 \u0442\u0435\u043b\u0435 DllMain \u0432\u044b\u0437\u043e\u0432 \u043b\u044e\u0431\u044b\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 <b>DLL<\/b>, \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0442 <b>Kernel32.dll<\/b>, \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u0442\u0440\u0443\u0434\u043d\u043e \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c<\/p>\n<pre><code class=\"cpp\">CoInitializeEx(nullptr, COINIT_MULTITHREADED);<\/code><\/pre>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0432 DllMain:<\/b> <br \/>   \u2014 \u0438\u0437\u0431\u0435\u0433\u0430\u0439\u0442\u0435 \u043b\u044e\u0431\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 (\u0434\u0435)\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<br \/>   \u2014 \u0438\u0437\u0431\u0435\u0433\u0430\u0439\u0442\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a (\u0438\u043b\u0438, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u0431\u0443\u0434\u044c\u0442\u0435 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u044b \u0441 \u044d\u0442\u0438\u043c)<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/c3\/3w\/x3\/c33wx30sm8ggfwamjhbkwigr4s0.png\"><\/p>\n<p>  17) \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0430\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0432 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435<\/p>\n<p>  18) \u0442. \u043a. \u0432\u0440\u0435\u043c\u044f, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <a href=\"http:\/\/www.cplusplus.com\/reference\/ctime\/time\">time<\/a>, \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 1 \u0441\u0435\u043a., \u043b\u044e\u0431\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0413\u041f\u0421\u0427 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044e \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0439 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0438\u043c\u0451\u043d \u0434\u043b\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u043d\u043e\u043c\u0435\u0440\u043e\u0432 \u043f\u043e\u0440\u0442\u043e\u0432 \u0438 \u0442.\u0434.). \u041e\u0434\u043d\u043e \u0438\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u2014 \u0441\u043c\u0435\u0448\u0430\u0442\u044c (<a href=\"https:\/\/stackoverflow.com\/questions\/2334218\/why-are-xor-often-used-in-java-hashcode-but-another-bitwise-operators-are-used\/2334270\">xor<\/a>) \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441 \u043a\u0430\u043a\u0438\u043c-\u0442\u043e <a href=\"http:\/\/www.pcg-random.org\/posts\/simple-portable-cpp-seed-entropy.html\">\u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c<\/a>, \u0442\u0430\u043a\u0438\u043c \u043a\u0430\u043a \u0430\u0434\u0440\u0435\u0441 \u043b\u044e\u0431\u043e\u0433\u043e \u0441\u0442\u044d\u043a\u0430 \u0438\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432 \u043a\u0443\u0447\u0435, \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0438 \u0442.\u0434.<\/p>\n<pre><code class=\"cpp\">srand(time(nullptr));<\/code><\/pre>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/b> <a href=\"https:\/\/stackoverflow.com\/questions\/6161322\/using-stdlibs-rand-from-multiple-threads\/6163508#6163508\">MS VS \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0413\u041f\u0421\u0427 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430<\/a>. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, <a href=\"https:\/\/wiki.sei.cmu.edu\/confluence\/display\/cplusplus\/MSC51-CPP.+Ensure+your+random+number+generator+is+properly+seeded\">\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 <i>Unix<\/i> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u044d\u043d\u0442\u0440\u043e\u043f\u0438\u0438<\/a>, \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/wiki.sei.cmu.edu\/confluence\/display\/c\/MSC32-C.+Properly+seed+pseudorandom+number+generators\">\u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u0443\u044e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/a>.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0442\u0430\u043a\u0436\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\"><a href=\"https:\/\/stackoverflow.com\/questions\/7617587\/is-there-an-alternative-to-using-time-to-seed-a-random-number-generation\">Is there an alternative to using time to seed a random number generation?<\/a><br \/>  <a href=\"http:\/\/www.pcg-random.org\/posts\/cpp-seeding-surprises.html\">C++ seeding surprises<\/a><br \/>  <a href=\"https:\/\/devblogs.microsoft.com\/pfxteam\/getting-random-numbers-in-a-thread-safe-way\">Getting random numbers in a thread-safe way<\/a> [C#]<\/div>\n<\/p><\/div>\n<p>  19) \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0442\u0443\u043f\u0438\u043a \u0438\u043b\u0438 \u0441\u0431\u043e\u0439 (\u0438\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0446\u0438\u043a\u043b\u044b \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 <b>DLL<\/b>)<\/p>\n<pre><code class=\"cpp\">OTHER_LIB = LoadLibrary(&quot;B.dll&quot;);<\/code><\/pre>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/b> <a href=\"https:\/\/docs.microsoft.com\/ru-ru\/windows\/desktop\/Dlls\/dynamic-link-library-best-practices\">\u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 LoadLibrary \u0432 \u0442\u043e\u0447\u043a\u0435 \u0432\u0445\u043e\u0434\u0430 DllMain<\/a>. \u041b\u044e\u0431\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u0430\u044f (\u0434\u0435)\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c DLL \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <i>\u00abInit\u00bb<\/i> \u0438 <i>\u00abDeint\u00bb<\/i>. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u044d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e, \u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0445 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0432 \u043d\u0443\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c. \u041e\u0431\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u0442\u0440\u043e\u0433\u043e \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cd\/1a\/qo\/cd1aqonsxxu81j4kitkk77uj4pg.png\"><\/p>\n<p>  20) \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0430 (\u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043b\u043e\u0436\u043d\u043e), \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430\u044f \u0443\u0442\u0435\u0447\u043a\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 (\u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 OTHER_LIB \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435) <\/p>\n<pre><code class=\"cpp\">if (OTHER_LIB = nullptr)     return FALSE;<\/code><\/pre>\n<p>  <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/language\/copy_assignment\">\u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u0443\u0442\u0451\u043c \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/a> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0443 \u043b\u0435\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u0442.\u0435. if \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 OTHER_LIB (\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 nullptr) \u0438 nullptr \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043a\u0430\u043a false.<\/p>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/b> \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0444\u043e\u0440\u043c\u0443, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0445 \u043e\u043f\u0435\u0447\u0430\u0442\u043e\u043a:<\/p>\n<pre><code class=\"cpp\">if\/while (&lt;constant&gt; == &lt;variable\/expression&gt;)<\/code><\/pre>\n<p>  21) \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e _beginthread \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0441\u043b\u0438\u043d\u043a\u043e\u0432\u0430\u043d\u043e \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f C) \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0443\u0442\u0435\u0447\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 ExitThread, DisableThreadLibraryCalls <\/p>\n<p>  22) \u0432\u0441\u0435 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u044b DllMain \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u044e\u0442\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0442\u0435\u043b\u0435 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u0442\u043e\u043a\u0438\/\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0438\u043b\u0438 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u0441 \u043d\u0438\u043c\u0438 \u043a\u0430\u043a\u043e\u0435-\u043b\u0438\u0431\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u0438\u043d\u0430\u0447\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u0432\u0437\u0430\u0438\u043c\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a<\/p>\n<pre><code class=\"cpp\">CreateThread(nullptr, 0U, &amp;Init, nullptr, 0U, nullptr);<\/code><\/pre>\n<p>  23) \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 COM \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b DLL \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u043c\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u0443 \u043a \u043f\u0430\u043c\u044f\u0442\u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0443\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0433\u0440\u0443\u0436\u0435\u043d<\/p>\n<pre><code class=\"cpp\">CoUninitialize();<\/code><\/pre>\n<p>  24) \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0438 \u0432\u043d\u0443\u0442\u0440\u0438\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 COM\/OLE, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0439\u0442\u0435 OleInitialize \u0438\u043b\u0438 OleUninitialize \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 DllMain<\/p>\n<pre><code class=\"cpp\">OleUninitialize();<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0442\u0430\u043a\u0436\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\"><a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/com\/com-clients-and-servers\">COM Clients and Servers<\/a><br \/>  <a href=\"http:\/\/docs.embarcadero.com\/products\/rad_studio\/delphiAndcpp2009\/HelpUpdate2\/EN\/html\/devwin32\/oocinprocessoutofprocessandremoteservers_xml.html\">In-process, Out-of-process, and Remote Servers<\/a>  <\/div>\n<\/p><\/div>\n<p>  25) \u0432\u044b\u0437\u043e\u0432 free \u0434\u043b\u044f \u0431\u043b\u043e\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e new<\/p>\n<p>  26) \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u0442\u0430\u0434\u0438\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b (\u043d\u0430 \u0447\u0442\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 lpvReserved), \u0432\u0441\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435, \u043a\u0440\u043e\u043c\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e, \u043b\u0438\u0431\u043e \u0443\u0436\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u044b, \u043b\u0438\u0431\u043e \u0431\u044b\u043b\u0438 \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 ExitProcess, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u043a\u0443\u0447\u0430, \u0432 \u043d\u0435\u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043e\u0447\u0438\u0449\u0430\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u0434\u043b\u044f <b>DLL<\/b>. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e <b>DLL<\/b> \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c<\/p>\n<pre><code class=\"cpp\">free(INTEGERS);<\/code><\/pre>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/b> \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0441\u0442\u0430\u0440\u044b\u0439 \u0441\u0442\u0438\u043b\u044c C \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0435 \u0441\u043c\u0435\u0448\u0430\u043d \u0441 \u201c\u043d\u043e\u0432\u044b\u043c\u201d \u0441\u0442\u0438\u043b\u0435\u043c, \u043f\u0440\u0438\u043d\u044f\u0442\u044b\u043c \u0432 C++. \u0411\u0443\u0434\u044c\u0442\u0435 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u044b \u043f\u0440\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/dlls\/dllmain\">DllMain<\/a>.<\/p>\n<p>  27) \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e DLL \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0430 \u0441\u0432\u043e\u0439 \u043a\u043e\u0434 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f<\/p>\n<pre><code class=\"cpp\">const BOOL result = FreeLibrary(OTHER_LIB);<\/code><\/pre>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/b> <b>\u043d\u0435<\/b> \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/api\/libloaderapi\/nf-libloaderapi-freelibrary\">FreeLibrary<\/a> \u0432 \u0442\u043e\u0447\u043a\u0435 \u0432\u0445\u043e\u0434\u0430 DllMain.<\/p>\n<p>  28) \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0441\u0431\u043e\u0439 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e) \u043f\u043e\u0442\u043e\u043a\u0430 <\/p>\n<pre><code class=\"cpp\">throw new std::runtime_error(&quot;\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0435 \u0431\u044b\u043b \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d&quot;);<\/code><\/pre>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/b> \u0438\u0437\u0431\u0435\u0433\u0430\u0439\u0442\u0435 \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 DllMain. \u0415\u0441\u043b\u0438 <b>DLL<\/b> \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430 \u043f\u043e \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435, \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c FALSE. \u0412\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u0441\u0435\u043a\u0446\u0438\u0438 DLL_PROCESS_DETACH \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442.<\/p>\n<p>  \u0412\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u044c\u0442\u0435 \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u044b, \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b DLL. \u041b\u044e\u0431\u044b\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043b\u0430\u0441\u0441\u044b <a href=\"https:\/\/en.wikipedia.org\/wiki\/C%2B%2B_Standard_Library\">\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/a>) \u043c\u043e\u0433\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u043e\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 (\u0438 \u0434\u0430\u0436\u0435 \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b) \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044f\u0445 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 (\u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u043c\u0438) \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Runtime_library\">\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/a>.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/oj\/ql\/bp\/ojqlbpvt23fze7rqdyd16rdwspm.png\"><\/p>\n<p>  \u041f\u043e\u0441\u0442\u0430\u0440\u0430\u0439\u0442\u0435\u0441\u044c \u043e\u0431\u043c\u0435\u043d\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 \u0442\u043e\u043b\u044c\u043a\u043e <a href=\"https:\/\/en.wikipedia.org\/wiki\/Passive_data_structure\">\u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/a> (\u0441 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0438 \u0447\u0435\u0442\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c).<\/p>\n<p>  \u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438 \u0438\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0432\u0440\u0435\u0434\u0438\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c, \u043e\u0441\u0442\u0430\u0432\u0438\u0432 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u043c \u0438 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u044d\u0442\u0438 \u043f\u043e\u0442\u043e\u043a\u0438 \u0443\u0436\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u0443\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0430\u0447\u043d\u0443\u0442 \u0441\u0432\u043e\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0434\u0435\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u043f\u044b\u0442\u0430\u0439\u0442\u0435\u0441\u044c \u0432 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430\u0445 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432).<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0442\u0430\u043a\u0436\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\"><a href=\"https:\/\/www.acodersjourney.com\/top-20-cplusplus-multithreading-mistakes\">Top 20 C++ multithreading mistakes and how to avoid them<\/a>  <\/div>\n<\/p><\/div>\n<p>  29) <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/container\/vector\/push_back\">\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043a\u0438\u043d\u0443\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/a> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, std::bad_alloc), \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f <\/p>\n<pre><code class=\"cpp\">THREADS.push_back(std::this_thread::get_id());<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u0435\u043a\u0446\u0438\u044f DLL_THREAD_ATTACH \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043e\u0434\u0430, \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0439\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435.<\/p>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/b> \u043f\u0440\u0438\u043b\u043e\u0436\u0438\u0442\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b try\/catch \u0442\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0432\u044b\u0445\u043e\u0434\u044f\u0442 \u0438\u0437 <b>\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 DLL<\/b>).<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0442\u0430\u043a\u0436\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\"><a href=\"https:\/\/isocpp.org\/wiki\/faq\/exceptions#dtors-shouldnt-throw\">How can I handle a destructor that fails?<\/a>  <\/div>\n<\/p><\/div>\n<p>  30) <b>UB<\/b>, \u0435\u0441\u043b\u0438 <b>\u0434\u043e<\/b> \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u044d\u0442\u043e\u0439 <b>DLL<\/b> \u0431\u044b\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043f\u043e\u0442\u043e\u043a\u0438 <\/p>\n<pre><code class=\"cpp\">THREADS.pop_back();<\/code><\/pre>\n<p>  \u0423\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 DLL \u043f\u043e\u0442\u043e\u043a\u0438 (\u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0442\u043e\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 <b>DLL<\/b>) \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0442\u043e\u0447\u043a\u0438 \u0432\u0445\u043e\u0434\u0430 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u043e\u0439 <b>DLL<\/b> (\u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0438 \u043d\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u0432\u0435\u043a\u0442\u043e\u0440\u0435 THREADS \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f DLL_THREAD_ATTACH), \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u043e\u043d\u0438 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 \u0435\u0433\u043e \u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u0435\u043c DLL_THREAD_DETACH \u043f\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438.<br \/>  \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043a \u0441\u0435\u043a\u0446\u0438\u044f\u043c DLL_THREAD_ATTACH \u0438 DLL_THREAD_DETACH \u0444\u0443\u043d\u043a\u0446\u0438\u0438 DllMain \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043d\u044b\u043c.<\/p>\n<p>  31) \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/types\/integer\">\u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430<\/a><\/p>\n<p>  32) \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043c\u0435\u0436\u0434\u0443 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0441\u0431\u043e\u0439, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u0438 \u0444\u043b\u0430\u0433\u0430\u043c\u0438 \u043b\u0438\u043d\u043a\u043e\u0432\u043a\u0438 \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 (\u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0442. \u0434.)<\/p>\n<p>  33) \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0443 c \u043f\u043e \u0435\u0433\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443 (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u0449\u0438\u043c \u0434\u043b\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u0439) \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0435\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u044d\u0442\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u044f\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 <a href=\"https:\/\/docs.microsoft.com\/en-us\/cpp\/build\/reference\/largeaddressaware-handle-large-addresses?view=vs-2019\">LARGEADDRESSAWARE<\/a>) <\/p>\n<pre><code class=\"cpp\">__declspec(dllexport) int Initialize(std::vector&lt;int&gt; integers, int&amp; c) throw() <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0442\u0430\u043a\u0436\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\"><a href=\"https:\/\/www.viva64.com\/en\/k\/0001\">Is it possible to use more than 2 Gbytes of memory in a 32-bit program launched in the 64-bit Windows?<\/a><br \/>  <a href=\"https:\/\/stackoverflow.com\/questions\/25424236\/application-with-largeaddressaware-flag-set-getting-less-virtual-memory\">Application with LARGEADDRESSAWARE flag set getting less virtual memory<\/a><br \/>  <a href=\"https:\/\/stackoverflow.com\/questions\/2288728\/drawbacks-of-using-largeaddressaware-for-32-bit-windows-executables\">Drawbacks of using \/LARGEADDRESSAWARE for 32 bit Windows executables?<\/a><br \/>  <a href=\"https:\/\/stackoverflow.com\/questions\/9054469\/how-to-check-if-exe-is-set-as-largeaddressaware\">how to check if exe is set as LARGEADDRESSAWARE<\/a> <i>[C#]<\/i><br \/>  <a href=\"https:\/\/stackoverflow.com\/questions\/9054469\/how-to-check-if-exe-is-set-as-largeaddressaware\">\/LARGEADDRESSAWARE \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u0440\u0442\u0438\u0442\u044c \u0432\u0430\u043c \u0432\u0435\u0441\u044c \u0434\u0435\u043d\u044c<\/a> <i>[Ru]<\/i><br \/>  <a href=\"https:\/\/ru.bmstu.wiki\/ASLR_(Address_Space_Layout_Randomization)\">ASLR (Address Space Layout Randomization)<\/a> <i>[Ru]<\/i>  <\/div>\n<\/p><\/div>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0410 \u0442\u0430\u043a\u0436\u0435&#8230;<\/b>                         <\/p>\n<div class=\"spoiler_text\"><a href=\"https:\/\/en.wikipedia.org\/wiki\/Virtual_memory\">Virtual memory<\/a><br \/>  <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/memory\/physical-address-extension\">Physical Address Extension<\/a><br \/>  <a href=\"https:\/\/en.wikipedia.org\/wiki\/Tagged_pointer\">Tagged pointer<\/a><br \/>  <a href=\"https:\/\/www.viva64.com\/ru\/a\/0050\">std::ptrdiff_t<\/a><br \/>  <a href=\"https:\/\/stackoverflow.com\/questions\/1845482\/what-is-uintptr-t-data-type\">What is uintptr_t data type<\/a><br \/>  <a href=\"https:\/\/www.learncpp.com\/cpp-tutorial\/6-8a-pointer-arithmetic-and-array-indexing\">Pointer arithmetic<\/a><br \/>  <a href=\"https:\/\/en.wikipedia.org\/wiki\/Pointer_aliasing\">Pointer aliasing<\/a><br \/>  <a href=\"https:\/\/stackoverflow.com\/questions\/98650\/what-is-the-strict-aliasing-rule\">What is the strict aliasing rule?<\/a><br \/>  <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/language\/reinterpret_cast\">reinterpret_cast conversion<\/a><br \/>  <a href=\"https:\/\/en.cppreference.com\/w\/c\/language\/restrict\">restrict type qualifier<\/a>  <\/div>\n<\/p><\/div>\n<p>  \u0412\u0440\u044f\u0434 \u043b\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u044b\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0432\u0430\u0436\u043d\u043e\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0447\u0435\u043c \u043e \u043d\u0435\u0439 \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u0443\u043c\u0430\u044e\u0442. \u0412\u043d\u0435 \u0432\u0441\u044f\u043a\u0438\u0445 \u0441\u043e\u043c\u043d\u0435\u043d\u0438\u0439, \u043c\u0430\u0442\u0435\u0440\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u043c\u043e\u0433\u0443\u0442 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043d\u044e\u0430\u043d\u0441\u044b \u0438 \u0442\u043e\u043d\u043a\u043e\u0441\u0442\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e-\u0442\u043e \u043e \u0440\u0430\u0437\u043d\u0438\u0446\u0435 \u043c\u0435\u0436\u0434\u0443 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/language\/pointer\">\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e<\/a>, \u0438\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, <a href=\"https:\/\/stackoverflow.com\/questions\/20763616\/how-many-bytes-do-pointers-take-up\">\u043d\u0435 \u0432\u0441\u0435 \u0431\u0438\u0442\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b<\/a>, \u0438 \u0442.\u0434.).<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kp\/7g\/jx\/kp7gjxfzcudjx4glxdeqqicgeg8.png\"><\/div>\n<p>  34) \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <a href=\"http:\/\/www.cplusplus.com\/reference\/new\/operator%20new%5B%5D\">\u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0431\u0440\u043e\u0448\u0435\u043d\u043e<\/a> <a href=\"http:\/\/www.cplusplus.com\/reference\/exception\/exception\">\u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/a>:<\/p>\n<pre><code class=\"cpp\">INTEGERS = new std::vector&lt;int&gt;(integers);<\/code><\/pre>\n<p>  \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f throw() \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0443\u0441\u0442\u0430:<\/p>\n<pre><code class=\"cpp\">__declspec(dllexport) int Initialize(std::vector&lt;int&gt; integers, int&amp; c) throw()<\/code><\/pre>\n<p>  <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/error\/unexpected\">std::unexpected \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0440\u0435\u0434\u043e\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f C++<\/a> \u043f\u0440\u0438 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f: \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0442\u0438\u043f\u0430.<\/p>\n<p>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435:<\/b> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 try \/ catch (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u0440\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432 <b>DLL<\/b>) \u0438\u043b\u0438 nothrow \u0444\u043e\u0440\u043c\u0443 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 new. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, <a href=\"https:\/\/wiki.sei.cmu.edu\/confluence\/display\/c\/MEM11-C.+Do+not+assume+infinite+heap+space\">\u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0438\u0441\u0445\u043e\u0434\u0438\u0442\u0435 \u0438\u0437 \u043d\u0430\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e<\/a>.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0442\u0430\u043a\u0436\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\"><a href=\"https:\/\/en.wikipedia.org\/wiki\/Resource_acquisition_is_initialization\">RAII<\/a><br \/>  <a href=\"https:\/\/google.github.io\/styleguide\/cppguide.html#Exceptions\">We do not use C++ exceptions<\/a><br \/>  <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/memory\/memory-limits-for-windows-releases\">Memory Limits for Windows and Windows Server Releases<\/a>  <\/div>\n<\/p><\/div>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/oq\/66\/nm\/oq66nm3wnt8c8iqe6fipkl5la_k.png\"><\/div>\n<p>  <b>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 1:<\/b> \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0433\u043e <i>\u00ab\u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e\u00bb<\/i> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e. \u041a\u0430\u043a \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Central_limit_theorem\">\u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0442\u0435\u043e\u0440\u0435\u043c\u0430<\/a>, \u0441\u0443\u043c\u043c\u0430 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0441\u044f \u043a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Normal_distribution\">\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e<\/a>, \u0430 \u043d\u0435 \u043a \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u043c\u0443 (\u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0441\u0430\u043c\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e).<\/p>\n<p>  <b>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 2:<\/b> \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 (\u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <a href=\"https:\/\/en.wikipedia.org\/wiki\/Integer_overflow#Methods_to_mitigate_integer_overflow_problems\">\u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c \u0434\u043b\u044f \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0441\u043e \u0437\u043d\u0430\u043a\u043e\u043c<\/a>)<\/p>\n<pre><code class=\"cpp\">return rand() + rand();<\/code><\/pre>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430\u044f \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c\u0438 \u0432\u0435\u0449\u0430\u043c\u0438, \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0441\u0442\u0435\u0440\u0435\u0433\u0430\u0439\u0442\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0430\u043c\u043e\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u00ab\u0440\u0435\u0448\u0435\u043d\u0438\u0439\u00bb. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043e\u043f\u044b\u0442\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u044d\u0442\u0438\u043c\u0438 \u043a\u0440\u0430\u0439\u043d\u0435 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u043c\u0438, \u043e\u0447\u0435\u043d\u044c \u0432\u044b\u0441\u043e\u043a\u0438 \u0448\u0430\u043d\u0441\u044b, \u0447\u0442\u043e \u0432\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0445\u0438\u0442\u0440\u0438\u0442\u0435 \u0441\u0430\u043c\u0438 \u0441\u0435\u0431\u044f \u0438 \u043b\u0438\u0448\u044c \u0443\u0441\u0443\u0433\u0443\u0431\u0438\u0442\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e.<\/p>\n<p>  35) \u0438\u043c\u044f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043a\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e (\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043e), \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u044d\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 extern \u00abC\u00bb<\/p>\n<p>  36) \u0438\u043c\u0435\u043d\u0430, \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0441 &#8216;_&#8217;, \u043d\u0435\u044f\u0432\u043d\u043e \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d\u044b \u0434\u043b\u044f C++, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e\u0442 \u0441\u0442\u0438\u043b\u044c \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d \u0434\u043b\u044f STL<\/p>\n<pre><code class=\"cpp\">__declspec(dllexport) long long int __cdecl _GetInt(int a)<\/code><\/pre>\n<p>  <b>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c (\u0438 \u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f):<\/b><\/p>\n<p>  37) <a href=\"https:\/\/en.cppreference.com\/w\/c\/numeric\/random\/rand\">rand<\/a> <b>\u043d\u0435<\/b> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c, \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/linux.die.net\/man\/3\/rand_r\">rand_r<\/a>\/<a href=\"https:\/\/docs.microsoft.com\/ru-ru\/cpp\/c-runtime-library\/reference\/rand-s?view=vs-2019\">rand_s<\/a><\/p>\n<p>  38) rand \u0443\u0441\u0442\u0430\u0440\u0435\u043b, <a href=\"https:\/\/channel9.msdn.com\/Events\/GoingNative\/2013\/rand-Considered-Harmful\">\u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c<\/a> \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 <\/p>\n<pre><code class=\"cpp\">C++11 &lt;random&gt;<\/code><\/pre>\n<p>  39) \u043d\u0435 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f rand \u0431\u044b\u043b\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 (MS VS \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430, \u0433\u0434\u0435 \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f)<\/p>\n<p>  40) <a href=\"https:\/\/en.wikipedia.org\/wiki\/Cryptographically_secure_pseudorandom_number_generator\">\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u043f\u0441\u0435\u0432\u0434\u043e\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b<\/a>, \u0438 \u0432 \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u044b\u0445 \u043a\u043e \u0432\u0437\u043b\u043e\u043c\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u0445 <a href=\"https:\/\/wiki.sei.cmu.edu\/confluence\/display\/c\/MSC30-C.+Do+not+use+the+rand%28%29+function+for+generating+pseudorandom+numbers\">\u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0438\u0445<\/a> (\u043f\u043e\u0434\u043e\u0439\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u0440\u043e\u0434\u0435 <a href=\"https:\/\/libsodium.gitbook.io\/doc\/generating_random_data\"><b>Libsodium<\/b>\/randombytes_buf<\/a>, <a href=\"https:\/\/www.openssl.org\/docs\/man1.1.0\/man3\/RAND_bytes.html\"><b>OpenSSL<\/b>\/RAND_bytes<\/a> \u0438 \u0442.\u0434.)<\/p>\n<p>  41) \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u043d\u043e\u043b\u044c: \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0430\u0432\u0430\u0440\u0438\u0439\u043d\u043e\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430<\/p>\n<p>  42) \u0432 \u043e\u0434\u043d\u043e\u043c \u0440\u044f\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b <a href=\"https:\/\/en.cppreference.com\/w\/c\/language\/operator_precedence\">\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0441 \u0440\u0430\u0437\u043d\u044b\u043c \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043e\u043c<\/a>, \u0447\u0442\u043e \u0432\u043d\u043e\u0441\u0438\u0442 \u0445\u0430\u043e\u0441 \u0432 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u2013 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0439\u0442\u0435 \u0441\u043a\u043e\u0431\u043a\u0438 \u0438\/\u0438\u043b\u0438 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Sequence_point\">\u0442\u043e\u0447\u043a\u0438 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f<\/a> \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f<\/p>\n<p>  43) \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Integer_overflow\">\u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430<\/a> <\/p>\n<pre><code class=\"cpp\">return 100 \/ a &lt;= 0 ? a : a + 1 + Random();<\/code><\/pre>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0442\u0430\u043a\u0436\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\"><a href=\"https:\/\/wiki.sei.cmu.edu\/confluence\/display\/cplusplus\/MSC50-CPP.+Do+not+use+std%3A%3Arand%28%29+for+generating+pseudorandom+numbers\">Do not use std::rand() for generating pseudorandom numbers<\/a>  <\/div>\n<\/p><\/div>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0410 \u0442\u0430\u043a\u0436\u0435&#8230;<\/b>                         <\/p>\n<div class=\"spoiler_text\"><a href=\"https:\/\/docs.microsoft.com\/ru-ru\/windows\/win32\/api\/processthreadsapi\/nf-processthreadsapi-exitthread\">ExitThread function<\/a><br \/>  <a href=\"https:\/\/docs.microsoft.com\/ru-ru\/windows\/win32\/api\/processthreadsapi\/nf-processthreadsapi-exitprocess\">ExitProcess function<\/a><br \/>  <a href=\"https:\/\/docs.microsoft.com\/ru-ru\/windows\/win32\/api\/processthreadsapi\/nf-processthreadsapi-terminatethread\">TerminateThread function<\/a><br \/>  <a href=\"https:\/\/docs.microsoft.com\/ru-ru\/windows\/win32\/api\/processthreadsapi\/nf-processthreadsapi-terminateprocess\">TerminateProcess function<\/a>  <\/div>\n<\/p><\/div>\n<h3>\u0418 \u044d\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0432\u0441\u0451!<\/h3>\n<p>  \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0432\u0430\u0436\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f). \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, <a href=\"https:\/\/www.sjoerdlangkemper.nl\/2016\/05\/22\/should-passwords-be-cleared-from-memory\">\u0432\u044b \u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u043f\u0430\u043c\u044f\u0442\u0438<\/a> \u0434\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044f \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043a\u0442\u043e-\u0442\u043e <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/api\/memoryapi\/nf-memoryapi-readprocessmemory\">\u043c\u043e\u0436\u0435\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0435\u0433\u043e \u043e\u0442\u0442\u0443\u0434\u0430<\/a>.<\/p>\n<p>  <a href=\"https:\/\/dwheeler.com\/secure-programs\/Secure-Programs-HOWTO\/protect-secrets.html\">\u041d\u0430\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/a> \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">bool login(char* const userNameBuf, const size_t userNameBufSize,            char* const pwdBuf, const size_t pwdBufSize) throw() {     if (nullptr == userNameBuf || '\\0' == *userNameBuf || nullptr == pwdBuf)         return false;          \/\/ Here some actual implementation, which does not checks params     \/\/  nor does it care of the 'userNameBuf' or 'pwdBuf' lifetime,     \/\/   while both of them obviously contains private information      const bool result = doLoginInternall(userNameBuf, pwdBuf);          \/\/ We want to minimize the time this private information is stored within the memory     memset(userNameBuf, 0, userNameBufSize);     memset(pwdBuf, 0, pwdBufSize); }<\/code><\/pre>\n<p>  \u0418 \u044d\u0442\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, <a href=\"https:\/\/www.viva64.com\/en\/k\/0041\"><b>\u043d\u0435<\/b> \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c<\/a> \u0442\u0430\u043a, \u043a\u0430\u043a \u0431\u044b \u043d\u0430\u043c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c. \u0427\u0442\u043e \u0436\u0435 \u0442\u043e\u0433\u0434\u0430 \u0434\u0435\u043b\u0430\u0442\u044c? \ud83d\ude41<\/p>\n<p>  <b>\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 <i>\u00ab\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u00bb<\/i> \u21161:<\/b> \u0435\u0441\u043b\u0438 <i>memset<\/i> \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e!<\/p>\n<pre><code class=\"cpp\">void clearMemory(char* const memBuf, const size_t memBufSize) throw() {     if (!memBuf || memBufSize &lt; 1U)         return;          for (size_t idx = 0U; idx &lt; memBufSize; ++idx)         memBuf[idx] = '\\0'; }<\/code><\/pre>\n<p>  \u041f\u043e\u0447\u0435\u043c\u0443 \u0438 \u044d\u0442\u043e \u043d\u0430\u043c \u0442\u043e\u0436\u0435 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442? \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u043a\u043e\u0434\u0435 \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b <b>\u043d\u0435<\/b> \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u0438 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443 <a href=\"https:\/\/wiki.sei.cmu.edu\/confluence\/display\/c\/MSC06-C.+Beware+of+compiler+optimizations\">\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e<\/a> (\u043a\u0441\u0442\u0430\u0442\u0438, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <a href=\"https:\/\/www.viva64.com\/en\/b\/0360\">memset<\/a>, \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0432\u0441\u0451 \u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0431\u0443\u0434\u0435\u0442 <a href=\"https:\/\/docs.microsoft.com\/en-us\/cpp\/intrinsics\/compiler-intrinsics?view=vs-2019\">\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439<\/a>).<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0442\u0430\u043a\u0436\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\"><a href=\"https:\/\/en.cppreference.com\/w\/cpp\/language\/as_if\">The as-if rule<\/a><br \/>  <a href=\"https:\/\/stackoverflow.com\/questions\/15718262\/what-exactly-is-the-as-if-rule\">Are there situations where this rule does not apply?<\/a><br \/>  <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/language\/copy_elision\">Copy elision<\/a><br \/>  <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2015\/n4455.html\">Atomics and optimization<\/a>  <\/div>\n<\/p><\/div>\n<p>  <b>\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 <i>\u00ab\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u00bb<\/i> #2:<\/b> \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u00ab\u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c\u00bb \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 \u00ab\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u00bb, \u043f\u043e\u0438\u0433\u0440\u0430\u0432\u0448\u0438\u0441\u044c \u0441 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u0441\u043b\u043e\u0432\u043e\u043c <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/language\/cv\">volatile<\/a><\/p>\n<pre><code class=\"cpp\">void clearMemory(volatile char* const volatile memBuf, const volatile size_t memBufSize) throw() {     if (!memBuf || memBufSize &lt; 1U)         return;          for (volatile size_t idx = 0U; idx &lt; memBufSize; ++idx)         memBuf[idx] = '\\0';          *(volatile char*)memBuf = *(volatile char*)memBuf;     \/\/ There is also possibility for someone to remove this &quot;useless&quot; code in the future } <\/code><\/pre>\n<p>  \u0411\u0443\u0434\u0435\u0442 \u043b\u0438 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c? \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 <a href=\"https:\/\/docs.microsoft.com\/en-us\/previous-versions\/windows\/desktop\/legacy\/aa366877(v%3Dvs.85)\">RtlSecureZeroMemory<\/a> (\u0432 \u0447\u0451\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 <b>Windows<\/b> <a href=\"https:\/\/en.wikipedia.org\/wiki\/Software_development_kit\"><b>SDK<\/b><\/a>).<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e, \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c <a href=\"http:\/\/www.daemonology.net\/blog\/2014-09-04-how-to-zero-a-buffer.html\">\u043d\u0435 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430\u043c\u0438<\/a>.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0442\u0430\u043a\u0436\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\"><a href=\"https:\/\/en.cppreference.com\/w\/cpp\/language\/member_functions#const-.2C_volatile-.2C_and_ref-qualified_member_functions\">volatile member functions<\/a>  <\/div>\n<\/p><\/div>\n<p>  <b>\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 <i>\u00ab\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u00bb<\/i> #3:<\/b> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <b>API \u041e\u0421<\/b> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <i>RtlZeroMemory<\/i>) \u0438\u043b\u0438 <b>STL<\/b> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, std::fill, std::for_each)<\/p>\n<pre><code class=\"cpp\">RtlZeroMemory(memBuf, memBufSize);<\/code><\/pre>\n<p>  \u0414\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b <a href=\"http:\/\/www.open-std.org\/jtc1\/sc22\/wg14\/www\/docs\/n1381.pdf\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<h4>\u0418 \u043a\u0430\u043a \u0436\u0435 \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e??<\/h4>\n<p>  \u25cf \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <b>API \u041e\u0421<\/b>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, RtlSecureZeroMemory \u0434\u043b\u044f <b>Windows<\/b><br \/>  \u25cf \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <i>C11<\/i> <a href=\"https:\/\/en.cppreference.com\/w\/c\/string\/byte\/memset\">memset_s<\/a>:<\/p>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043c\u0435\u0448\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043f\u0443\u0442\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0430 (\u0432 \u0444\u0430\u0439\u043b, \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0442\u043e\u043a) \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u043d\u043e \u044d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u0435\u043d.<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0442\u0430\u043a\u0436\u0435<\/b>                         <\/p>\n<div class=\"spoiler_text\"><a href=\"https:\/\/www.viva64.com\/en\/b\/0388\">Safe clearing of private Data<\/a>  <\/div>\n<\/p><\/div>\n<h3>\u041f\u043e\u0434\u0432\u043e\u0434\u044f \u0438\u0442\u043e\u0433\u0438<\/h3>\n<p>  \u042d\u0442\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0435 \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u043d\u044e\u0430\u043d\u0441\u043e\u0432 \u0438 \u0442\u043e\u043d\u043a\u043e\u0441\u0442\u0435\u0439 \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 <i>C\/C++<\/i>.<\/p>\n<p>  \u0415\u0441\u0442\u044c \u0442\u0430\u043a\u0436\u0435 \u0438 \u0442\u0430\u043a\u0438\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u0435\u0449\u0438, \u043a\u0430\u043a:<\/p>\n<ul>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Deadlock#Livelock\">\u00ab\u0436\u0438\u0432\u044b\u0435\u00bb \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438<\/a>;<\/li>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Race_condition\">\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0433\u043e\u043d\u043a\u0438<\/a> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u044b\u0435 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Non-blocking_algorithm\">\u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/ABA_problem\">\u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 ABA<\/a>, \u043d\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Reference_counting\">\u0441\u0447\u0435\u0442\u0447\u0438\u043a\u043e\u0432 \u0441\u0441\u044b\u043b\u043e\u043a<\/a>, \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Double-checked_locking\">\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0441 \u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439<\/a>);<\/li>\n<li><a href=\"https:\/\/stackoverflow.com\/questions\/274626\/what-is-object-slicing\">\u0441\u0440\u0435\u0437\u043a\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/a>;<\/li>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Loss_of_significance\">\u043f\u043e\u0442\u0435\u0440\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438<\/a> (\u0438\u0437-\u0437\u0430 \u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0439 \u043d\u0435\u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0447\u0438\u0441\u0435\u043b \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 \u0431\u0435\u0437 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u0445 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438);<\/li>\n<li>\u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/procthread\/multiple-threads-and-gdi-objects\">\u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 GDI \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432;<\/a><\/li>\n<li>\u043f\u0443\u0442\u0430\u043d\u0438\u0446\u0430, \u043d\u0435\u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <a href=\"http:\/\/www.drdobbs.com\/parallel\/volatile-vs-volatile\/212701484\">volatile \u0438 atomic<\/a> \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445;<\/li>\n<li>\u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 0603 \u0432\u043c\u0435\u0441\u0442\u043e 603);<\/li>\n<li>\u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0440\u0430\u0441\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438\/\u0434\u043e\u0441\u0442\u0443\u043f\u0430 (<a href=\"https:\/\/en.wikipedia.org\/wiki\/Time-of-check_to_time-of-use\">time-of-check to time-of-use<\/a>);<\/li>\n<li>\u043b\u044f\u043c\u0431\u0434\u0430-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0436\u0438\u0432\u0443\u0442 \u0434\u043e\u043b\u044c\u0448\u0435 \u0441\u0432\u043e\u0438\u0445 \u0437\u0430\u0445\u0432\u0430\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0430\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432;<\/li>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Printf_format_string#Invalid_conversion_specifications\">\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0445 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0439 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430 printf<\/a>;<\/li>\n<li>\u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u043c\u0435\u043d \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u0441 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Endianness\">\u0440\u0430\u0437\u043d\u044b\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u043c \u0431\u0430\u0439\u0442\u043e\u0432<\/a> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0442\u044c) \u0438 \u0442. \u0434. \u0438 \u0442. \u043f.;<\/li>\n<\/ul>\n<p>  \u0418 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435 \ud83d\ude09<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/y0\/qj\/tx\/y0qjtx5d-oki-9qo8qeesdadrmu.png\"><\/p>\n<p>  <b>\u0415\u0441\u0442\u044c \u0447\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c? \u041f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0441\u0432\u043e\u0438\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u043e\u043f\u044b\u0442\u043e\u043c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445!<\/b><\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">P.S. \u0425\u043e\u0442\u0438\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435?<\/b>                         <\/p>\n<div class=\"spoiler_text\"><a href=\"https:\/\/vulncat.fortify.com\/en\/weakness?kingdom=Security%20Features\">Software security errors<\/a><br \/>  <a href=\"https:\/\/cwe.mitre.org\/index.html\">Common weakness enumeration<\/a><br \/>  <a href=\"https:\/\/www.owasp.org\/index.php\/Category:Vulnerability\">Common types of software vulnerabilities<\/a><\/p>\n<p>  <a href=\"https:\/\/www.sourceclear.com\/vulnerability-database\/search#_\">Vulnerability database<\/a><br \/>  <a href=\"https:\/\/www.kb.cert.org\/vuls\/bypublished\/desc\">Vulnerability notes database<\/a><br \/>  <a href=\"https:\/\/en.wikipedia.org\/wiki\/National_Vulnerability_Database\">National vulnerability database<\/a><\/p>\n<p>  <a href=\"https:\/\/wiki.sei.cmu.edu\/confluence\">Coding standards<\/a><br \/>  <a href=\"https:\/\/cheatsheetseries.owasp.org\/cheatsheets\/IndexASVS.html\">Application security verification standard<\/a><br \/>  <a href=\"https:\/\/www.misra.org.uk\/Activities\/MISRAC\/tabid\/171\/Default.aspx\">Guidelines for the use of the C++ language in critical systems<\/a><\/p>\n<p>  <a href=\"https:\/\/dwheeler.com\/secure-programs\/Secure-Programs-HOWTO\/index.html\">Secure programming HOWTO<\/a><br \/>  <a href=\"https:\/\/www.viva64.com\/en\/a\/0054\">32 OpenMP Traps For C++ Developers<\/a><br \/>  <a href=\"https:\/\/www.viva64.com\/en\/a\/0065\">A Collection of Examples of 64-bit Errors in Real Programs<\/a><\/p><\/div>\n<\/p><\/div>\n<\/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=\"https:\/\/habr.com\/ru\/company\/simbirsoft\/blog\/521018\/\"> https:\/\/habr.com\/ru\/company\/simbirsoft\/blog\/521018\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/simbirsoft\/blog\/521018\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/x8\/bd\/cl\/x8bdcla3jusety8mujrcdbdri3m.png\"><\/p>\n<blockquote><p>\u201cC \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0432 \u043d\u043e\u0433\u0443. \u041d\u0430 C++ \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u043d\u043e \u043d\u043e\u0433\u0443 \u043e\u0442\u043e\u0440\u0432\u0451\u0442 \u0446\u0435\u043b\u0438\u043a\u043e\u043c\u201d \u2014 \u0411\u044c\u0451\u0440\u043d \u0421\u0442\u0440\u0430\u0443\u0441\u0442\u0440\u0443\u043f, \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u044c C++.<\/p><\/blockquote>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u043e\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439, \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0438 \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0433\u043a\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0435\u0433\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u043f\u0440\u0435\u0434\u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u043e\u043c\u0430\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0438\u0441\u044c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u0438 \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/pd\/gc\/an\/pdgcaneemmqwaeeo1otp-6k5bl0.png\"><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-310721","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/310721","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=310721"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/310721\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=310721"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=310721"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=310721"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}