Questions: 11
Time: 30 min
Welcome to Dmitry Sviridkin's quiz inspired by his e-book, "C++ programmer's guide to undefined behavior". If you've read it, you may want to challenge your memory. And if you haven't, you'll find this even more entertaining :)
The task is to guess how 10 cringe code examples may behave. Don't take it too seriously, though. When it comes to undefined behavior, no one can predict how the program will behave—this is why it's undefined. Just have some fun :)
Results
Great job! You've earned a promo code for a 30-day trial from PVS-Studio.
{"uid": "ub_quiz", "time": {"ru": "30 \u043c\u0438\u043d", "en": "30 min", "fr": "30 min"}, "image": {"ru": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Zaglavka_p5GaZqo_thm__-x-.png", "fr": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Zaglavka_thm__-x-.png", "en": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Zaglavka_thm__-x-.png"}, "text": {"ru": "<p>\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u043a\u0432\u0438\u0437 \u0414\u043c\u0438\u0442\u0440\u0438\u044f \u0421\u0432\u0438\u0440\u0438\u0434\u043a\u0438\u043d\u0430 \u043f\u043e \u043c\u043e\u0442\u0438\u0432\u0430\u043c \u0435\u0433\u043e \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043a\u043d\u0438\u0433\u0438 \"<a href=\"https://pvs-studio.ru/ru/blog/posts/cpp/1215/\">\u041f\u0443\u0442\u0435\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c C++ \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430 \u043f\u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e</a>\". \u0415\u0441\u043b\u0438 \u0432\u044b \u0435\u0451 \u0447\u0438\u0442\u0430\u043b\u0438, \u0442\u043e \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u0432\u043e\u044e \u043f\u0430\u043c\u044f\u0442\u044c. \u0410 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0447\u0438\u0442\u0430\u043b\u0438, \u0442\u043e \u0432\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0435\u0449\u0451 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435 :)</p>\r\n<p>\u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0433\u0430\u0434\u0430\u0442\u044c, \u043a\u0430\u043a \u043c\u043e\u0433\u0443\u0442 \u0432\u0435\u0441\u0442\u0438 \u0441\u0435\u0431\u044f 10 \u043a\u0440\u0438\u043d\u0436\u043e\u0432\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043a\u043e\u0434\u0430. \u0422\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u0441\u044c \u043a \u044d\u0442\u043e\u043c\u0443 \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u043e. \u041a\u043e\u0433\u0434\u0430 \u0440\u0435\u0447\u044c \u0438\u0434\u0451\u0442 \u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438, \u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u043f\u043e\u0432\u0435\u0434\u0451\u0442 \u0441\u0435\u0431\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u043e\u043d\u043e \u0438 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435. \u041f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0437\u0432\u043b\u0435\u043a\u0438\u0442\u0435\u0441\u044c :)</p>", "en": "<p>Welcome to Dmitry Sviridkin's quiz inspired by his e-book, \"<a href=\"https://pvs-studio.com/en/blog/posts/cpp/1215/\">C++ programmer's guide to undefined behavior</a>\". If you've read it, you may want to challenge your memory. And if you haven't, you'll find this even more entertaining :)</p>\r\n<p>The task is to guess how 10 cringe code examples may behave. Don't take it too seriously, though. When it comes to undefined behavior, no one can predict how the program will behave—this is why it's undefined. Just have some fun :)</p>", "fr": "<p>Welcome to Dmitry Sviridkin's quiz inspired by his e-book, \"<a href=\"https://pvs-studio.com/en/blog/posts/cpp/1215/\">C++ programmer's guide to undefined behavior</a>\". If you've read it, you may want to challenge your memory. And if you haven't, you'll find this even more entertaining :)</p>\r\n<p>The task is to guess how 10 cringe code examples may behave. Don't take it too seriously, though. When it comes to undefined behavior, no one can predict how the program will behave—this is why it's undefined. Just have some fun :)</p>"}, "title": {"ru": "\u041a\u0432\u0438\u0437 \u043f\u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e \u043e\u0442 \u0414\u043c\u0438\u0442\u0440\u0438\u044f \u0421\u0432\u0438\u0440\u0438\u0434\u043a\u0438\u043d\u0430", "en": "Quiz on undefined behavior by Dmitry Sviridkin", "fr": "Quiz on undefined behavior by Dmitry Sviridkin"}, "questions": [{"description": {"ru": "<pre>#include <iostream>\nvoid test(unsigned short index) {\n const unsigned short mult = 0xFFFF;\n int raw_id = (index * mult);\n if (raw_id >= 0) {\n std::cout << raw_id << \"\\n\";\n }\n}\nint main() {\n unsigned short idx = 0; std::cin >> idx;\n test(idx);\n}\n</pre><p>\u0427\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430, \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u0430\u044f \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438, \u043f\u0440\u0438 \u0432\u0432\u043e\u0434\u0435 \u0447\u0438\u0441\u043b\u0430 <i style=\"\">33600</i>?</p><p>\n</p><p>\n</p>", "en": "<p>\n</p><pre>#include <iostream><br>void test(unsigned short index) {<br> const unsigned short mult = 0xFFFF;<br> int raw_id = (index * mult);<br> if (raw_id >= 0) {<br> std::cout << raw_id << \"\\n\";<br> }<br>}<br>int main() {<br> unsigned short idx = 0; std::cin >> idx;<br> test(idx);<br>}\n</pre><p>\n</p><p>What might a program built with optimizations output when you enter <i style=\"\">33600</i>?</p><p>\n</p><p>\n</p>", "fr": "<p>\n</p><pre>#include <iostream><br>void test(unsigned short index) {<br> const unsigned short mult = 0xFFFF;<br> int raw_id = (index * mult);<br> if (raw_id >= 0) {<br> std::cout << raw_id << \"\\n\";<br> }<br>}<br>int main() {<br> unsigned short idx = 0; std::cin >> idx;<br> test(idx);<br>}\n</pre><p>\n</p><p>What might a program built with optimizations output when you enter <i style=\"\">33600</i>?</p><p>\n</p><p>\n</p>"}, "explanation": {"ru": "<p>\u041f\u0440\u0438 \u0443\u0440\u043e\u0432\u043d\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 <i>-O3</i> \u0441 Clang \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e. \u0411\u0435\u0437 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439 \u2014 \u043d\u0438\u0447\u0435\u0433\u043e.\n</p><p>\u0412 \u043a\u043e\u0434\u0435 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438\u0437-\u0437\u0430 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u041d\u043e \u0432\u0435\u0434\u044c \u043c\u044b \u0443\u043c\u043d\u043e\u0436\u0430\u043b\u0438 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0435\u2026 \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c <a href=\"https://en.cppreference.com/w/c/language/conversion#Integer_promotions\">integer promotion</a>. \u041d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445, \u0433\u0434\u0435 <i>int</i> \u2014 4 \u0431\u0430\u0439\u0442\u0430, \u0430 <i>short</i> \u2014 2 \u0431\u0430\u0439\u0442\u0430, <i>unsigned short</i> \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u0435\u0440\u0435\u0434 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043d\u0435\u044f\u0432\u043d\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043a <i>int</i>.\n</p><p><a href=\"https://godbolt.org/z/rv89rj15d\">https://godbolt.org/z/rv89rj15d</a>\n</p><p><br></p>", "en": "<p>A negative number is successfully output when the code is compiled with Clang at <i>-O3</i> optimization level. It produces no output without optimizations.\n</p><p>The code contains undefined behavior caused by the signed integer overflow. Wait, but we multiplied unsigned ones... Thanks to the <a href=\"https://en.cppreference.com/w/c/language/conversion#Integer_promotions\">integer promotion</a> rules. On platforms where <i>int</i> is 4 bytes and <i>short</i> is 2 bytes, <i>unsigned short</i> arguments are implicitly cast to <i>int</i> before multiplication.\n</p><p><a href=\"https://godbolt.org/z/rv89rj15d\">https://godbolt.org/z/rv89rj15d</a>\n</p><p><br></p>", "fr": "<p>A negative number is successfully output when the code is compiled with Clang at <i>-O3</i> optimization level. It produces no output without optimizations.\n</p><p>The code contains undefined behavior caused by the signed integer overflow. Wait, but we multiplied unsigned ones... Thanks to the <a href=\"https://en.cppreference.com/w/c/language/conversion#Integer_promotions\">integer promotion</a> rules. On platforms where <i>int</i> is 4 bytes and <i>short</i> is 2 bytes, <i>unsigned short</i> arguments are implicitly cast to <i>int</i> before multiplication.\n</p><p><a href=\"https://godbolt.org/z/rv89rj15d\">https://godbolt.org/z/rv89rj15d</a>\n</p><p><br></p>"}, "answers": [{"text": {"ru": "\u041d\u0438\u0447\u0435\u0433\u043e", "en": "Nothing", "fr": "Nothing"}, "value": 0}, {"text": {"ru": "0", "en": "0", "fr": "0"}, "value": 0}, {"text": {"ru": "31936", "en": "31936", "fr": "31936"}, "value": 0}, {"text": {"ru": "-2092991296", "en": "-2092991296", "fr": "-2092991296"}, "value": 1}], "image": {"ru": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-10_PLADriD_thm__218x-.png", "fr": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-10_thm__218x-.png", "en": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-10_thm__218x-.png"}}, {"description": {"ru": "<p>\n</p><p>\n</p><p>\n</p><pre>struct CharTable {<br> static_assert(CHAR_BIT == 8);<br> std::array<bool, 256> _is_printable {};<br> CharTable() {<br> _is_printable.fill(true);<br> _is_printable[0x81] = false;<br> }<br> bool is_printable(char c) const {<br> return this->_is_printable[c];<br> }<br>};\n</pre><p>\n</p><p>\u041a\u0430\u043a\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0434\u0430\u0441\u0442 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <i>CharTable {}.is_printable(0x81)</i> \u043d\u0430 x86?</p><p>\n</p><p>\n</p>", "en": "<p>\n</p><p>\n</p><p>\n</p><pre>struct CharTable {<br> static_assert(CHAR_BIT == 8);<br> std::array<bool, 256> _is_printable {};<br> CharTable() {<br> _is_printable.fill(true);<br> _is_printable[0x81] = false;<br> }<br> bool is_printable(char c) const {<br> return this->_is_printable[c];<br> }<br>};\n</pre><p>\n</p><p>What is the result of the <i>CharTable {}.is_printable(0x81)</i> expression on x86?</p><p>\n</p><p>\n</p>", "fr": "<p>\n</p><p>\n</p><p>\n</p><pre>struct CharTable {<br> static_assert(CHAR_BIT == 8);<br> std::array<bool, 256> _is_printable {};<br> CharTable() {<br> _is_printable.fill(true);<br> _is_printable[0x81] = false;<br> }<br> bool is_printable(char c) const {<br> return this->_is_printable[c];<br> }<br>};\n</pre><p>\n</p><p>What is the result of the <i>CharTable {}.is_printable(0x81)</i> expression on x86?</p><p>\n</p><p>\n</p>"}, "explanation": {"ru": "<p>\u0417\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0438 \u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0441\u0442\u0438 <i>char</i>! \u041d\u0430 ARM \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e. \u0422\u0430\u043c `char` \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0439.\n</p><p>\u041d\u0430 x86 \u0432 \u043a\u043e\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u0417\u043d\u0430\u043a\u043e\u0432\u044b\u0439 <i>char</i> 0x81 (-127) \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0432 <i>std::array<T, N>::operator[](size_t)</i> \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u0447\u0438\u0441\u043b\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0438 \u0432\u0441\u0435 \u0432\u044b\u0442\u0435\u043a\u0430\u044e\u0449\u0438\u0435 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u0421 \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u044b\u0437\u043e\u0432 \u0443\u043f\u0430\u0434\u0451\u0442 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.\n</p><p><a href=\"https://godbolt.org/z/Wzzbdj1d9\">https://godbolt.org/z/Wzzbdj1d9</a>\n</p><p><br></p>", "en": "<p>It depends on the platform and the signedness of <i>char</i>! This code works correctly on ARM\u2014 <i>char</i> is unsigned there.\n</p><p>The code exhibits undefined behavior on x86. When passed to <i>std::array<T, N>::operator[](size_t)</i>, the signed <i>char</i> 0x81 (-127) turns into a large unsigned number that is bigger than the array size. We get an array overrun and all issues that come with it. The call is very likely to crash with a segmentation error.\n</p><p><a href=\"https://godbolt.org/z/Wzzbdj1d9\">https://godbolt.org/z/Wzzbdj1d9</a>\n</p><p><br></p>", "fr": "<p>It depends on the platform and the signedness of <i>char</i>! This code works correctly on ARM\u2014 <i>char</i> is unsigned there.\n</p><p>The code exhibits undefined behavior on x86. When passed to <i>std::array<T, N>::operator[](size_t)</i>, the signed <i>char</i> 0x81 (-127) turns into a large unsigned number that is bigger than the array size. We get an array overrun and all issues that come with it. The call is very likely to crash with a segmentation error.\n</p><p><a href=\"https://godbolt.org/z/Wzzbdj1d9\">https://godbolt.org/z/Wzzbdj1d9</a>\n</p><p><br></p>"}, "answers": [{"text": {"ru": "true", "en": "true", "fr": "true"}, "value": 0}, {"text": {"ru": "false", "en": "false", "fr": "false"}, "value": 0}, {"text": {"ru": "segmentation fault", "en": "segmentation fault", "fr": "segmentation fault"}, "value": 1}, {"text": {"ru": "\u044d\u0442\u043e \u043d\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f", "en": "this code doesn't compile", "fr": "this code doesn't compile"}, "value": 0}], "image": {"ru": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-9_Cwu7Uas_thm__218x-.png", "fr": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-9_thm__218x-.png", "en": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-9_thm__218x-.png"}}, {"description": {"ru": "<p>\n</p><pre>int* p = (int*)malloc(sizeof(int));<br>int* q = (int*)realloc(p, sizeof(int));<br>if (p == q) {<br> new(p) int (1);<br> new(q) int (2);<br> std::cout << *p << *q << '\\n';<br>}\n</pre><p><br></p><p>\u0427\u0442\u043e \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434?</p>", "en": "<p>\n</p><p>\n</p><pre>int* p = (int*)malloc(sizeof(int));<br>int* q = (int*)realloc(p, sizeof(int));<br>if (p == q) {<br> new(p) int (1);<br> new(q) int (2);<br> std::cout << *p << *q << '\\n';<br>}\n</pre><p>What does this code output?</p>", "fr": "<p>\n</p><p>\n</p><pre>int* p = (int*)malloc(sizeof(int));<br>int* q = (int*)realloc(p, sizeof(int));<br>if (p == q) {<br> new(p) int (1);<br> new(q) int (2);<br> std::cout << *p << *q << '\\n';<br>}\n</pre><p>What does this code output?</p>"}, "explanation": {"ru": "<p>\u0412 \u043a\u043e\u0434\u0435 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0443\u0440\u043e\u0432\u043d\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043b\u0438\u0431\u043e 12, \u043b\u0438\u0431\u043e 22. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 <i>realloc</i> \u043d\u0435\u043b\u044c\u0437\u044f. \u041e\u043d \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0438\u043d\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043d\u043e\u0432\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e \u0440\u0430\u0432\u0435\u043d \u0441\u0442\u0430\u0440\u043e\u043c\u0443.\n</p><p><a href=\"https://godbolt.org/z/8r1K1756s\">https://godbolt.org/z/8r1K1756s</a>\n</p><p><br></p><p>\n</p>", "en": "<p>The code contains undefined behavior. Depending on the optimization level, we get either 12 or 22. We can't use the old pointer after a successful <i>realloc</i> call. It's considered invalid even if the new pointer is equal to the old one.\n</p><p><a href=\"https://godbolt.org/z/8r1K1756s\">https://godbolt.org/z/8r1K1756s</a>\n</p><p><br></p><p>\n</p>", "fr": "<p>The code contains undefined behavior. Depending on the optimization level, we get either 12 or 22. We can't use the old pointer after a successful <i>realloc</i> call. It's considered invalid even if the new pointer is equal to the old one.\n</p><p><a href=\"https://godbolt.org/z/8r1K1756s\">https://godbolt.org/z/8r1K1756s</a>\n</p><p><br></p><p>\n</p>"}, "answers": [{"text": {"ru": "\u043c\u043e\u0436\u0435\u0442 12, \u043c\u043e\u0436\u0435\u0442 22", "en": "12 or 22", "fr": "12 or 22"}, "value": 1}, {"text": {"ru": "22", "en": "22", "fr": "22"}, "value": 0}, {"text": {"ru": "12", "en": "12", "fr": "12"}, "value": 0}, {"text": {"ru": "11", "en": "11", "fr": "11"}, "value": 0}], "image": {"ru": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-11_xqJdmI7_thm__218x-.png", "fr": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-11_thm__218x-.png", "en": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-11_thm__218x-.png"}}, {"description": {"ru": "<pre>struct Timer {<br> int val;<br> explicit Timer(int v = 0) : val(v) {}<br>};<br>struct Worker {<br> int time_to_work;<br> explicit Worker(Timer t) : time_to_work(t.val) {}<br> friend std::ostream& operator << (std::ostream& os, const Worker& w) {<br> return os << \"Time to work=\" << w.time_to_work;<br> }<br>};<br>int main() {<br> const int time_to_work = 10;<br> Worker w(Timer(time_to_work)); <br> std::cout << w;<br>}\n</pre><p>\u041a\u0430\u043a\u0438\u043c \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043e\u0434\u0430?</p><p><br></p><p>\n</p><p>\n</p><p>\n</p><p>\n</p>", "en": "<pre>struct Timer {<br> int val;<br> explicit Timer(int v = 0) : val(v) {}<br>};<br>struct Worker {<br> int time_to_work;<br> explicit Worker(Timer t) : time_to_work(t.val) {}<br> friend std::ostream& operator << (std::ostream& os, const Worker& w) {<br> return os << \"Time to work=\" << w.time_to_work;<br> }<br>};<br>int main() {<br> const int time_to_work = 10;<br> Worker w(Timer(time_to_work)); <br> std::cout << w;<br>}\n</pre><p>What is the result of this code execution?</p><p>\n</p><p>\n</p><p>\n</p><p>\n</p>", "fr": "<pre>struct Timer {<br> int val;<br> explicit Timer(int v = 0) : val(v) {}<br>};<br>struct Worker {<br> int time_to_work;<br> explicit Worker(Timer t) : time_to_work(t.val) {}<br> friend std::ostream& operator << (std::ostream& os, const Worker& w) {<br> return os << \"Time to work=\" << w.time_to_work;<br> }<br>};<br>int main() {<br> const int time_to_work = 10;<br> Worker w(Timer(time_to_work)); <br> std::cout << w;<br>}\n</pre><p>What is the result of this code execution?</p><p>\n</p><p>\n</p><p>\n</p><p>\n</p>"}, "explanation": {"ru": "<p>\u0412\u0441\u0451 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e! \u042d\u0442\u043e most vexing parse. \u0412\u043c\u0435\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <i>worker</i> \u043c\u044b \u043e\u0431\u044a\u044f\u0432\u0438\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0443\u044e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0442\u0438\u043f\u0430 <i>Timer</i>, a <i>time_to_work </i>\u2014 \u0438\u043c\u044f \u044d\u0442\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430. \u0410 \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442\u0441\u044f 1, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \"\u0444\u0443\u043d\u043a\u0446\u0438\u044e\" \u0435\u0451 \u0430\u0434\u0440\u0435\u0441 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d \u043a\u2026 <i>bool</i>! \u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, GCC \u0438 Clang) \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0434\u0438\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u043c \u0431\u0435\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u0438.\n</p><p><a href=\"https://godbolt.org/z/q5vavWW5x\">https://godbolt.org/z/q5vavWW5x</a>\n</p><p><br></p>", "en": "<p>Everything is defined! This is the most vexing parse. Instead of creating the <i>worker</i> object, we declared a function that takes an argument of the <i>Timer</i> type with the <i>time_to_work</i> name. It returns 1 because when we try to output a \"function\", its address is cast to <i>bool</i>! Modern compilers, like GCC and Clang, can warn us about this mess.\n</p><p><a href=\"https://godbolt.org/z/q5vavWW5x\">https://godbolt.org/z/q5vavWW5x</a>\n</p><p><br></p>", "fr": "<p>Everything is defined! This is the most vexing parse. Instead of creating the <i>worker</i> object, we declared a function that takes an argument of the <i>Timer</i> type with the <i>time_to_work</i> name. It returns 1 because when we try to output a \"function\", its address is cast to <i>bool</i>! Modern compilers, like GCC and Clang, can warn us about this mess.\n</p><p><a href=\"https://godbolt.org/z/q5vavWW5x\">https://godbolt.org/z/q5vavWW5x</a>\n</p><p><br></p>"}, "answers": [{"text": {"ru": "\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 1", "en": "it outputs 1", "fr": "it outputs 1"}, "value": 1}, {"text": {"ru": "\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e", "en": "it outputs a random number", "fr": "it outputs a random number"}, "value": 0}, {"text": {"ru": "\"Time to work 10\"", "en": "\"Time to work 10\"", "fr": "\"Time to work 10\""}, "value": 0}, {"text": {"ru": "\u0438\u0437-\u0437\u0430 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e (\u043c\u0443\u0441\u043e\u0440\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442)", "en": "it can output anything (including garbage text) due to undefined behavior", "fr": "it can output anything (including garbage text) due to undefined behavior"}, "value": 0}], "image": {"ru": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-12_Qy7byBY_thm__218x-.png", "fr": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-12_thm__218x-.png", "en": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-12_thm__218x-.png"}}, {"description": {"ru": "<p>\n</p><pre>struct Component {<br> std::string name;<br> static auto type() -> std::string_view {<br> return \"Component\";<br> }<br>};<br>int main() {<br> Component* c = nullptr;<br> std::cout << c->type() << \"\\n\";<br>}\n</pre><p>\n</p><p>\u0412\u0441\u0451 \u043b\u0438 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435?</p><p>\n</p><p>\n</p>", "en": "<p>\n</p><pre>struct Component {<br> std::string name;<br> static auto type() -> std::string_view {<br> return \"Component\";<br> }<br>};<br>int main() {<br> Component* c = nullptr;<br> std::cout << c->type() << \"\\n\";<br>}\n</pre><p>\n</p><p>Is the code correct?</p><p>\n</p><p>\n</p>", "fr": "<p>\n</p><pre>struct Component {<br> std::string name;<br> static auto type() -> std::string_view {<br> return \"Component\";<br> }<br>};<br>int main() {<br> Component* c = nullptr;<br> std::cout << c->type() << \"\\n\";<br>}\n</pre><p>\n</p><p>Is the code correct?</p><p>\n</p><p>\n</p>"}, "explanation": {"ru": "<p>\u0412 \u0438\u044e\u043b\u0435 2024 \u0433\u043e\u0434\u0430 \u043a\u043e\u043c\u0438\u0442\u0435\u0442 \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 <a href=\"https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#315\">\u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435</a>. \u041d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \"\u043e\u0434\u043e\u0431\u0440\u044f\u0442\" \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u0432\u0435\u0434\u044c \u0440\u0430\u043d\u044c\u0448\u0435 \u0441\u0447\u0438\u0442\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0443\u0442 \u043d\u0435\u0442. \u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f-\u0447\u043b\u0435\u043d \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0441 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0430.</p>", "en": "<p>In July 2024, the committee finally decided that this is <a href=\"https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#315\">undefined behavior</a> after all. However, the most popular compilers \"approve\" this code, as it was previously considered free of undefined behavior. Indeed, the static member function doesn't interact with the class instance in any way.</p>", "fr": "<p>In July 2024, the committee finally decided that this is <a href=\"https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#315\">undefined behavior</a> after all. However, the most popular compilers \"approve\" this code, as it was previously considered free of undefined behavior. Indeed, the static member function doesn't interact with the class instance in any way.</p>"}, "answers": [{"text": {"ru": "\u0434\u0430, \u0432\u0435\u0434\u044c \u044d\u0442\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u0435\u0442\u043e\u0434", "en": "yes, this is a static method", "fr": "yes, this is a static method"}, "value": 0}, {"text": {"ru": "\u043d\u0435\u0442, \u0432\u0435\u0434\u044c \u044d\u0442\u043e `nullptr`", "en": "no, this is `nullptr`", "fr": "no, this is `nullptr`"}, "value": 0}, {"text": {"ru": "\u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0438\u0442\u0435\u0442\u0430 \u043f\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u0438 C++", "en": "it depends on how the C++ standardization committee feels about it", "fr": "it depends on how the C++ standardization committee feels about it"}, "value": 1}], "image": {"ru": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-13_TUVEPcJ_thm__218x-.png", "fr": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-13_thm__218x-.png", "en": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-13_thm__218x-.png"}}, {"description": {"ru": "<pre>template <class T><br>struct MayBeUninitialized {<br> static_assert(alignof(T) >= 2); // \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431 \u0432<br> // \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0431\u0438\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0445\u0440\u0430\u043d\u0438\u0442\u044c<br> // \u0441\u0442\u0430\u0442\u0443\u0441 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<br> MayBeUninitialized() {<br> ptr_repr_ |= 1; // set unitialized flag<br> }<br> ....<br> bool IsInitialized() const {<br> return !(ptr_repr_ & 1);<br> }<br> ....<br> const T& Get() const {<br> if (!IsInitialized()) {<br> throw std::runtime_error(\"not inited\");<br> }<br> return *GetPointer();<br> }<br>private:<br> T* GetPointer() const {<br> constexpr auto mask = ~static_cast<uintptr_t>(1);<br> auto ptr = reinterpret_cast<T*>(ptr_repr_ & mask);<br> return ptr;<br> }<br> uintptr_t ptr_repr_;<br>};\n</pre><p>\u0412\u0441\u0451 \u043b\u0438 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>Get</i> \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 <i>Optional</i>?</p><p>\n</p>", "en": "<pre>template <class T><br>struct MayBeUninitialized {<br> static_assert(alignof(T) >= 2); // alignment is enough<br> // to store the initialization status<br> // in the last bit of the pointer<br> MayBeUninitialized() {<br> ptr_repr_ |= 1; // set unitialized flag<br> }<br> ....<br> bool IsInitialized() const {<br> return !(ptr_repr_ & 1);<br> }<br> ....<br> const T& Get() const {<br> if (!IsInitialized()) {<br> throw std::runtime_error(\"not inited\");<br> }<br> return *GetPointer();<br> }<br>private:<br> T* GetPointer() const {<br> constexpr auto mask = ~static_cast<uintptr_t>(1);<br> auto ptr = reinterpret_cast<T*>(ptr_repr_ & mask);<br> return ptr;<br> }<br> uintptr_t ptr_repr_;<br>};\n</pre><p>Is everything okay in the <i>Get</i> function of such a simple <i>Optional</i> class?</p><p>\n</p>", "fr": "<pre>template <class T><br>struct MayBeUninitialized {<br> static_assert(alignof(T) >= 2); // alignment is enough<br> // to store the initialization status<br> // in the last bit of the pointer<br> MayBeUninitialized() {<br> ptr_repr_ |= 1; // set unitialized flag<br> }<br> ....<br> bool IsInitialized() const {<br> return !(ptr_repr_ & 1);<br> }<br> ....<br> const T& Get() const {<br> if (!IsInitialized()) {<br> throw std::runtime_error(\"not inited\");<br> }<br> return *GetPointer();<br> }<br>private:<br> T* GetPointer() const {<br> constexpr auto mask = ~static_cast<uintptr_t>(1);<br> auto ptr = reinterpret_cast<T*>(ptr_repr_ & mask);<br> return ptr;<br> }<br> uintptr_t ptr_repr_;<br>};\n</pre><p>Is everything okay in the <i>Get</i> function of such a simple <i>Optional</i> class?</p><p>\n</p>"}, "explanation": {"ru": "<p>\u0414\u043e \u0421++23 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 C++ \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430 \u043c\u0443\u0441\u043e\u0440\u0430. \u0418 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0441\u044b\u0440\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0432\u0441\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0432\u043b\u0435\u0447\u044c \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u043e\u043c \u043c\u0443\u0441\u043e\u0440\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u0438\u043c: <a href=\"https://en.wikipedia.org/wiki/Boehm_garbage_collector\">https://en.wikipedia.org/wiki/Boehm_garbage_collector</a>\n</p><p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>Get</i> \u2014 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u0442.\u043a. \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0431\u044b\u043b \u0438\u0441\u043f\u043e\u0440\u0447\u0435\u043d \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 <i>(ptr_repr_ |= 1)</i>.\n</p><p>\u0412 C++23 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430 \u043c\u0443\u0441\u043e\u0440\u0430 \u0432\u044b\u0431\u0440\u043e\u0441\u0438\u043b\u0438 \u0432 \u043c\u0443\u0441\u043e\u0440. \u0422\u0430\u043a \u0447\u0442\u043e \u0432\u0441\u0451 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435\u2026 \u041f\u043e\u0447\u0442\u0438. <i>std::launder(GetPointer())</i> \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c: \u043c\u0430\u043b\u043e \u043b\u0438, \u0432\u043d\u0443\u0442\u0440\u0438 <i>T</i> \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c <i>const</i> \u043f\u043e\u043b\u044f, \u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u041d\u043e \u044d\u0442\u043e \u0443\u0436\u0435 \u0434\u0440\u0443\u0433\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f.\n</p><p><br></p>", "en": "<p>Prior to C++23, the C++ standard mentioned garbage collector support. In some alternate universe, destroying the last raw pointer to allocated memory could cause the garbage collector to free that memory. For example, it might be this one: <a href=\"https://en.wikipedia.org/wiki/Boehm_garbage_collector.\">https://en.wikipedia.org/wiki/Boehm_garbage_collector.</a> \n</p><p>So, technically, the <i>Get</i> function contains undefined behavior because the only original pointer was corrupted in the constructor (see the <i>(ptr_repr_ |= 1);</i> statement).\n</p><p>In C++23, the idea of garbage collector support was thrown straight into the garbage. So, everything is fine... almost. We'd better add <i>std::launder(GetPointer())</i> after all: there may be <i>const</i> data members within <i>T</i>, and we may get undefined behavior when reinitializing the object. That's another story, though.\n</p><p><br></p>", "fr": "<p>Prior to C++23, the C++ standard mentioned garbage collector support. In some alternate universe, destroying the last raw pointer to allocated memory could cause the garbage collector to free that memory. For example, it might be this one: <a href=\"https://en.wikipedia.org/wiki/Boehm_garbage_collector.\">https://en.wikipedia.org/wiki/Boehm_garbage_collector.</a> \n</p><p>So, technically, the <i>Get</i> function contains undefined behavior because the only original pointer was corrupted in the constructor (see the <i>(ptr_repr_ |= 1);</i> statement).\n</p><p>In C++23, the idea of garbage collector support was thrown straight into the garbage. So, everything is fine... almost. We'd better add <i>std::launder(GetPointer())</i> after all: there may be <i>const</i> data members within <i>T</i>, and we may get undefined behavior when reinitializing the object. That's another story, though.\n</p><p><br></p>"}, "answers": [{"text": {"ru": "\u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 C++23, \u044d\u0442\u043e \u043d\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f", "en": "starting with C++23, the code doesn't compile", "fr": "starting with C++23, the code doesn't compile"}, "value": 0}, {"text": {"ru": "\u0434\u0430, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c", "en": "yep, everything is fine", "fr": "yep, everything is fine"}, "value": 0}, {"text": {"ru": "\u043d\u0443, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u043d\u0430\u0434\u043e std::launder \u0432\u043e\u0442\u043a\u043d\u0443\u0442\u044c\u2026", "en": "well, maybe we should add `std::launder`", "fr": "well, maybe we should add `std::launder`"}, "value": 0}, {"text": {"ru": "\u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430", "en": "it depends on the standard version", "fr": "it depends on the standard version"}, "value": 1}], "image": {"ru": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-14_3wBG390_thm__218x-.png", "fr": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-14_thm__218x-.png", "en": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-14_thm__218x-.png"}}, {"description": {"ru": "<pre>#pragma pack(push)<br>#pragma pack(1)<br>struct Record {<br> long value;<br> int data;<br> char status;<br>};<br>#pragma pack(pop)<br>int main() {<br> Record records[] = { { 42, 42, 42}, { 42, 42, 42} };<br> static_assert(<br> sizeof(records) == 2 * ( sizeof(int) + sizeof(char) + sizeof(long) ));<br> for (const auto& r: records) {<br> // 42 -- '*'<br> std::cout << std::format(\"{} {} {}\", r.data, r.status, r.value)<br> << '\\n';<br> }<br>}\n</pre><p>\u0412\u044b \u0436\u0435 \u043b\u044e\u0431\u0438\u0442\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b? \u041a\u0430\u043a \u043d\u0430\u0441\u0447\u0451\u0442 \u0442\u0430\u043a\u043e\u0439?</p><p>\n</p><p>\n</p>", "en": "<pre>#pragma pack(push)<br>#pragma pack(1)<br>struct Record {<br> long value;<br> int data;<br> char status;<br>};<br>#pragma pack(pop)<br>int main() {<br> Record records[] = { { 42, 42, 42}, { 42, 42, 42} };<br> static_assert(<br> sizeof(records) == 2 * ( sizeof(int) + sizeof(char) + sizeof(long) ));<br> for (const auto& r: records) {<br> // 42 -- '*'<br> std::cout << std::format(\"{} {} {}\", r.data, r.status, r.value)<br> << '\\n';<br> }<br>}\n</pre><p>Don't you enjoy formatting your structures? What about this one?</p><p>\n</p><p>\n</p>", "fr": "<pre>#pragma pack(push)<br>#pragma pack(1)<br>struct Record {<br> long value;<br> int data;<br> char status;<br>};<br>#pragma pack(pop)<br>int main() {<br> Record records[] = { { 42, 42, 42}, { 42, 42, 42} };<br> static_assert(<br> sizeof(records) == 2 * ( sizeof(int) + sizeof(char) + sizeof(long) ));<br> for (const auto& r: records) {<br> // 42 -- '*'<br> std::cout << std::format(\"{} {} {}\", r.data, r.status, r.value)<br> << '\\n';<br> }<br>}\n</pre><p>Don't you enjoy formatting your structures? What about this one?</p><p>\n</p><p>\n</p>"}, "explanation": {"ru": "<p>\u0412 \u043a\u043e\u0434\u0435 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u041d\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0446\u0438\u043a\u043b\u0430 \u0432 <i>std::format</i> \u0431\u0443\u0434\u0443\u0442 \u043d\u0435\u044f\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u043d\u0435\u0432\u044b\u0440\u043e\u0432\u043d\u0435\u043d\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043f\u043e\u043b\u044f <i>value</i> \u0438 <i>data</i>. \u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043f\u043e \u043d\u0435\u0432\u044b\u0440\u043e\u0432\u043d\u0435\u043d\u043d\u044b\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u043c \u0438 \u0441\u0441\u044b\u043b\u043a\u0430\u043c \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e. \u041f\u043e\u0434 x86 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c \u0447\u0442\u0435\u043d\u0438\u044e \u0438 \u0437\u0430\u043f\u0438\u0441\u0438. \u041f\u043e\u0434 ARM \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u0443\u043c\u0435\u0440\u0435\u0442\u044c \u0441 SIGBUS.</p>", "en": "<p>The code contains undefined behavior. On the second loop iteration, unaligned references to the <i>data</i> and <i>value</i> data members are implicitly passed to <i>std::format</i>. Accessing unaligned pointers and references leads to undefined behavior. It does work on x86, but often results in slow read and write operations. On ARM, the application can easily crash with a SIGBUS error.</p>", "fr": "<p>The code contains undefined behavior. On the second loop iteration, unaligned references to the <i>data</i> and <i>value</i> data members are implicitly passed to <i>std::format</i>. Accessing unaligned pointers and references leads to undefined behavior. It does work on x86, but often results in slow read and write operations. On ARM, the application can easily crash with a SIGBUS error.</p>"}, "answers": [{"text": {"ru": "\u043a\u043e\u0434 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0435\u043d \u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043a\u0440\u0430\u0441\u0438\u0432", "en": "the code is correct and quite pretty", "fr": "the code is correct and quite pretty"}, "value": 0}, {"text": {"ru": "\u0432 \u043a\u043e\u0434\u0435 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u0438 \u0432\u0435\u0437\u0434\u0435 \u0432\u0441\u0451 \u043f\u043b\u043e\u0445\u043e", "en": "the code contains undefined behavior and is utterly bad", "fr": "the code contains undefined behavior and is utterly bad"}, "value": 0}, {"text": {"ru": "\u0432 \u043a\u043e\u0434\u0435 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u043d\u043e \u043d\u0430 x86 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c", "en": "the code contains undefined behavior, but it will work on x86", "fr": "the code contains undefined behavior, but it will work on x86"}, "value": 1}, {"text": {"ru": "\u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u044e\u0442\u0441\u044f \u043d\u0443\u043b\u0438, \u043d\u043e \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u0438\u0437-\u0437\u0430 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f", "en": "it outputs zeros but not because of undefined behavior", "fr": "it outputs zeros but not because of undefined behavior"}, "value": 0}], "image": {"ru": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-15_u1iF5uB_thm__218x-.png", "fr": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-15_thm__218x-.png", "en": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-15_thm__218x-.png"}}, {"description": {"ru": "<pre>#include <iostream><br>int fermat () {<br> const int MAX = 1000;<br> int a=1,b=1,c=1;<br> while (1) {<br> if ( (a*a*a) == (b*b*b) + (c*c*c) ) return 1;<br> a++;<br> if (a>MAX) {<br> a=1;<br> b++;<br> }<br> if (b>MAX) {<br> b=1;<br> c++;<br> }<br> if (c>MAX) {<br> c=1;<br> }<br> }<br> return 0;<br>}<br>int main () {<br> if (fermat()) {<br> std::cout << \"Fermat's Last Theorem has been disproved.\\n\";<br> } else {<br> std::cout << \"Fermat's Last Theorem has not been disproved.\\n\";<br> }<br> return 0;<br>}\n</pre><p>\u0427\u0442\u043e \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442 \u0432\u0435\u043b\u0438\u043a\u0430\u044f \u0442\u0435\u043e\u0440\u0435\u043c\u0430 \u0424\u0435\u0440\u043c\u0430? \u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f \u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434?</p><p>\n</p><p>\n</p>", "en": "<pre>#include <iostream><br>int fermat () {<br> const int MAX = 1000;<br> int a=1,b=1,c=1;<br> while (1) {<br> if ( (a*a*a) == (b*b*b) + (c*c*c) ) return 1;<br> a++;<br> if (a>MAX) {<br> a=1;<br> b++;<br> }<br> if (b>MAX) {<br> b=1;<br> c++;<br> }<br> if (c>MAX) {<br> c=1;<br> }<br> }<br> return 0;<br>}<br>int main () {<br> if (fermat()) {<br> std::cout << \"Fermat's Last Theorem has been disproved.\\n\";<br> } else {<br> std::cout << \"Fermat's Last Theorem has not been disproved.\\n\";<br> }<br> return 0;<br>}\n</pre><p>What does Fermat's Last Theorem state? Will the code above complete?</p><p>\n</p><p>\n</p>", "fr": "<pre>#include <iostream><br>int fermat () {<br> const int MAX = 1000;<br> int a=1,b=1,c=1;<br> while (1) {<br> if ( (a*a*a) == (b*b*b) + (c*c*c) ) return 1;<br> a++;<br> if (a>MAX) {<br> a=1;<br> b++;<br> }<br> if (b>MAX) {<br> b=1;<br> c++;<br> }<br> if (c>MAX) {<br> c=1;<br> }<br> }<br> return 0;<br>}<br>int main () {<br> if (fermat()) {<br> std::cout << \"Fermat's Last Theorem has been disproved.\\n\";<br> } else {<br> std::cout << \"Fermat's Last Theorem has not been disproved.\\n\";<br> }<br> return 0;<br>}\n</pre><p>What does Fermat's Last Theorem state? Will the code above complete?</p><p>\n</p><p>\n</p>"}, "explanation": {"ru": "<p>\u0411\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u0446\u0438\u043a\u043b\u044b \u0431\u0435\u0437 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432 \u2014 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u041f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u044b\u0445 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f\u0445 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0445\u043e\u0434 \u0438\u0437 \u0446\u0438\u043a\u043b\u0430 \u2014 <i>return true</i>, \u0438 \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043e\u043f\u0440\u043e\u0432\u0435\u0440\u0433\u043d\u0443\u0442\u044c \u0442\u0435\u043e\u0440\u0435\u043c\u0443 \u0424\u0435\u0440\u043c\u0430.</p>", "en": "<p>Infinite loops without side effects are undefined behavior. With enabled optimizations, the compiler may find that the only way out of the loop is <i>return true</i>, thus disproving Fermat's theorem.</p>", "fr": "<p>Infinite loops without side effects are undefined behavior. With enabled optimizations, the compiler may find that the only way out of the loop is <i>return true</i>, thus disproving Fermat's theorem.</p>"}, "answers": [{"text": {"ru": "\u0424\u0435\u0440\u043c\u0430 \u0431\u044b\u043b \u043f\u0440\u0430\u0432. \u041a\u043e\u0434 \u0437\u0430\u0446\u0438\u043a\u043b\u0438\u0442\u0441\u044f: \u043d\u0435\u0442 \u0442\u0430\u043a\u0438\u0445 \u0442\u0440\u043e\u0435\u043a \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u042d\u0442\u043e \u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e, \u043d\u0435 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0432\u0448\u0435\u0435\u0441\u044f \u043d\u0430 \u043f\u043e\u043b\u044f \u043a\u043d\u0438\u0433\u0438", "en": "Fermat was right. The code will loop: there are no such integer triples. This is the proof that didn't fit in the margins of the book", "fr": "Fermat was right. The code will loop: there are no such integer triples. This is the proof that didn't fit in the margins of the book"}, "value": 0}, {"text": {"ru": "\u043a\u043e\u0434 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f \u0438 \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442: \"Theorem has been disproved\"", "en": "the code will complete and output, \"Theorem has been disproved\"", "fr": "the code will complete and output, \"Theorem has been disproved\""}, "value": 1}, {"text": {"ru": "\u043a\u043e\u0434 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f \u0438 \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442: \"Theorem has not been disproved\"", "en": "the code will complete and output, \"Theorem has not been disproved\"", "fr": "the code will complete and output, \"Theorem has not been disproved\""}, "value": 0}, {"text": {"ru": "\u0437\u0434\u0435\u0441\u044c \u043d\u0435\u0442 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f, \u043d\u043e \u0435\u0441\u0442\u044c \u043d\u044e\u0430\u043d\u0441 \u044f\u0437\u044b\u043a\u0430, \u0438\u0437-\u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u043d\u043e", "en": "the code doesn't contain undefined behavior, but there's a language peculiarity that causes nothing to be displayed", "fr": "the code doesn't contain undefined behavior, but there's a language peculiarity that causes nothing to be displayed"}, "value": 0}], "image": {"ru": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-16_jyVQpl7_thm__218x-.png", "fr": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-16_thm__218x-.png", "en": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-16_thm__218x-.png"}}, {"description": {"ru": "<pre>struct FStruct {<br> bool uninitializedBool;<br> __attribute__ ((noinline)) <br> FStruct() {};<br>};<br>char destBuffer[16];<br>void Serialize(bool boolValue) {<br> const char* whichString = boolValue ? \"true\" : \"false\";<br> size_t len = strlen(whichString);<br> memcpy(destBuffer, whichString, len);<br>}<br>int main()<br>{<br> FStruct structInstance;<br> Serialize(structInstance.uninitializedBool);<br> printf(\"%s\", destBuffer);<br> return 0;<br>}\n</pre><p>\u041a\u0430\u043a \u043d\u0430\u0441\u0447\u0451\u0442 \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445? \u0412\u0435\u0434\u044c \u043e\u043d\u0438 \u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u043c\u0443\u0441\u043e\u0440\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0434\u0430?</p><p> \n</p><p> \n</p><p>\n</p><p>\n</p><p>\n</p><p>\n</p>", "en": "<pre>struct FStruct {<br> bool uninitializedBool;<br> __attribute__ ((noinline)) <br> FStruct() {};<br>};<br>char destBuffer[16];<br>void Serialize(bool boolValue) {<br> const char* whichString = boolValue ? \"true\" : \"false\";<br> size_t len = strlen(whichString);<br> memcpy(destBuffer, whichString, len);<br>}<br>int main()<br>{<br> FStruct structInstance;<br> Serialize(structInstance.uninitializedBool);<br> printf(\"%s\", destBuffer);<br> return 0;<br>}\n</pre><p>What about uninitialized variables? They just take garbage values, don't they?</p><p> \n</p><p> \n</p><p>\n</p><p>\n</p><p>\n</p><p>\n</p>", "fr": "<pre>struct FStruct {<br> bool uninitializedBool;<br> __attribute__ ((noinline)) <br> FStruct() {};<br>};<br>char destBuffer[16];<br>void Serialize(bool boolValue) {<br> const char* whichString = boolValue ? \"true\" : \"false\";<br> size_t len = strlen(whichString);<br> memcpy(destBuffer, whichString, len);<br>}<br>int main()<br>{<br> FStruct structInstance;<br> Serialize(structInstance.uninitializedBool);<br> printf(\"%s\", destBuffer);<br> return 0;<br>}\n</pre><p>What about uninitialized variables? They just take garbage values, don't they?</p><p> \n</p><p> \n</p><p>\n</p><p>\n</p><p>\n</p><p>\n</p>"}, "explanation": {"ru": "<p>\u0421 Clang 10 \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0443\u0441\u043f\u0435\u0448\u043d\u043e <a href=\"https://godbolt.org/z/aPhGT4P6q\">\u0443\u043f\u0430\u0434\u0451\u0442</a> \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438! \u0427\u0442\u0435\u043d\u0438\u0435 \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043e C++26 \u0431\u044b\u043b\u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c. \u0422\u0430\u043a \u0447\u0442\u043e \u0445\u0438\u0442\u0440\u044b\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043c\u043e\u0433 \u043f\u0440\u043e\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u0438\u043d\u0442, \u0447\u0442\u043e\u0431 \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <i>strlen</i>:\n</p><pre>size_t len = 5 - boolValue\n</pre><p>\u0418 \u0443\u0440\u043e\u043d\u0438\u0442\u044c \u0432\u0430\u0441, \u0435\u0441\u043b\u0438 \u0442\u0430\u043c \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0431\u0438\u0442\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.\n</p><p>\u0412 \u0421++26 \u0447\u0442\u0435\u043d\u0438\u0435 \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \"\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438\" \u2014 \u0442\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0430 \u0438\u0445 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. \u0422\u0430\u043a \u0447\u0442\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0432\u0435\u0440\u0441\u0438\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0449\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043d\u043e\u0432\u0448\u0435\u0441\u0442\u0432\u0430 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430.\n</p><p><br></p>", "en": "<p>With Clang 10 and enabled optimizations, this code <a href=\"https://godbolt.org/z/aPhGT4P6q\">crashes</a> with a segmentation error! Before C++26, reading uninitialized memory was undefined behavior. So, a clever compiler could pull off the following trick to avoid calling <i>strlen</i>...\n</p><pre>size_t len = 5 - boolValue\n</pre><p>...and crash an application if it has some kind of a bit value.\n</p><p>In C++26, reading uninitialized variables is \"defined\"\u2014now compilers no longer have to perform weird optimizations on them. So, to get defined behavior, we need a compiler version that supports the latest updates to the standard.\n</p><p><br></p>", "fr": "<p>With Clang 10 and enabled optimizations, this code <a href=\"https://godbolt.org/z/aPhGT4P6q\">crashes</a> with a segmentation error! Before C++26, reading uninitialized memory was undefined behavior. So, a clever compiler could pull off the following trick to avoid calling <i>strlen</i>...\n</p><pre>size_t len = 5 - boolValue\n</pre><p>...and crash an application if it has some kind of a bit value.\n</p><p>In C++26, reading uninitialized variables is \"defined\"\u2014now compilers no longer have to perform weird optimizations on them. So, to get defined behavior, we need a compiler version that supports the latest updates to the standard.\n</p><p><br></p>"}, "answers": [{"text": {"ru": "\u043a\u043e\u0434 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 `true` \u0438\u043b\u0438 `false`", "en": "the code successfully outputs `true` or `false`", "fr": "the code successfully outputs `true` or `false`"}, "value": 0}, {"text": {"ru": "\u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430", "en": "it depends on the compiler", "fr": "it depends on the compiler"}, "value": 0}, {"text": {"ru": "\u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430", "en": "it depends on the standard version", "fr": "it depends on the standard version"}, "value": 0}, {"text": {"ru": "\u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u0438 \u043e\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430, \u0438 \u043e\u0442 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430", "en": "it depends on both the compiler and the standard version", "fr": "it depends on both the compiler and the standard version"}, "value": 1}], "image": {"ru": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-17_EroSLN8_thm__218x-.png", "fr": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-17_thm__218x-.png", "en": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-17_thm__218x-.png"}}, {"description": {"ru": "<pre>#include <stdio.h><br>int foo(int* x, short* y) {<br> *x = 5;<br> *y = 10;<br> return *x;<br>}<br>int main() {<br> int f = 0;<br> printf(\"%d\\n\", foo(&f, (short*)&f));<br>}\n</pre><p>\u0427\u0442\u043e \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434?</p><p>\n</p><p>\n</p>", "en": "<pre>#include <stdio.h><br>int foo(int* x, short* y) {<br> *x = 5;<br> *y = 10;<br> return *x;<br>}<br>int main() {<br> int f = 0;<br> printf(\"%d\\n\", foo(&f, (short*)&f));<br>}\n</pre><p>What does the following code output?</p><p>\n</p><p>\n</p>", "fr": "<pre>#include <stdio.h><br>int foo(int* x, short* y) {<br> *x = 5;<br> *y = 10;<br> return *x;<br>}<br>int main() {<br> int f = 0;<br> printf(\"%d\\n\", foo(&f, (short*)&f));<br>}\n</pre><p>What does the following code output?</p><p>\n</p><p>\n</p>"}, "explanation": {"ru": "<p>\u0417\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0444\u0430\u043a\u0442\u043e\u0440\u043e\u0432! \u0412 \u043e\u0431\u0449\u0435\u043c-\u0442\u043e, \u0432 \u043a\u043e\u0434\u0435 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u2014 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 strict aliasing. \u041d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 <i>short</i> \u0438 \u043d\u0430 <i>long</i> \u043d\u0430 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f! \u041d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0435 strict aliasing, \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0430\u0433\u0440\u0435\u0441\u0441\u0438\u0432\u043d\u044b \u0438:</p><ul><li>\u043b\u0438\u0431\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \u0438\u0445 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 (MSVC, \u0441\u0442\u0430\u0440\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 GCC \u0438 Clang);\n</li><li>\u043b\u0438\u0431\u043e \u0438\u0445 \u0446\u0435\u043b\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u043e\u0442 \u0433\u0440\u0435\u0445\u0430 \u043f\u043e\u0434\u0430\u043b\u044c\u0448\u0435.\n</li></ul><p>\u041f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 <a href=\"https://godbolt.org/z/GMExE5d75\">\u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c</a> 5 \u0432\u043c\u0435\u0441\u0442\u043e 10. \u0415\u0449\u0451 \u043e\u0442 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0431\u0430\u0439\u0442 \u0437\u0430\u0432\u0438\u0441\u0438\u0442, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435.\n</p><p><br></p>", "en": "<p>It depends on a lot of factors! Well, undefined behavior in the above code is a strict aliasing violation. A pointer to <i>short</i> and a pointer to <i>long</i> can't refer to the same object! However, optimizations that consider strict aliasing are quite harsh, so:\n</p><ul><li>either compilers don't execute them (MSVC, older versions of GCC and Clang);\n</li><li>or developers intentionally disable them.\n</li></ul><p>With the enabled optimization, <a href=\"https://godbolt.org/z/GMExE5d75\">we can get </a>5 instead of 10. It also depends on the byte order, of course.\n</p><p><br></p>", "fr": "<p>It depends on a lot of factors! Well, undefined behavior in the above code is a strict aliasing violation. A pointer to <i>short</i> and a pointer to <i>long</i> can't refer to the same object! However, optimizations that consider strict aliasing are quite harsh, so:\n</p><ul><li>either compilers don't execute them (MSVC, older versions of GCC and Clang);\n</li><li>or developers intentionally disable them.\n</li></ul><p>With the enabled optimization, <a href=\"https://godbolt.org/z/GMExE5d75\">we can get </a>5 instead of 10. It also depends on the byte order, of course.\n</p><p><br></p>"}, "answers": [{"text": {"ru": "5", "en": "5", "fr": "5"}, "value": 0}, {"text": {"ru": "10", "en": "10", "fr": "10"}, "value": 0}, {"text": {"ru": "0", "en": "0", "fr": "0"}, "value": 0}, {"text": {"ru": "\u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442\u2026", "en": "it depends...", "fr": "it depends..."}, "value": 1}], "image": {"ru": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-18_Wf8frFB_thm__218x-.png", "fr": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-18_thm__218x-.png", "en": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-18_thm__218x-.png"}}, {"description": {"ru": "<pre>std::vector<std::string> v {\"hello\"};<br>v.push_back(v.front());\n</pre><p>\u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0442\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c?</p>", "en": "<pre>std::vector<std::string> v {\"hello\"};<br>v.push_back(v.front());\n</pre><p>Is it okay to do this?</p>", "fr": "<pre>std::vector<std::string> v {\"hello\"};<br>v.push_back(v.front());\n</pre><p>Is it okay to do this?</p>"}, "explanation": {"ru": "<p>\u0414\u0430, \u0442\u0430\u043a <a href=\"https://godbolt.org/z/93W19rvr7\">\u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c</a>! \u042d\u0442\u043e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u043c \u0447\u0435\u0440\u0435\u0437 \u0441\u0430\u043c\u043e\u0435 \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e: \u043d\u0438\u0447\u0442\u043e \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0435 \u043d\u0435 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u0442\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u043d\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u0442\u0430\u043a \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u041d\u0443 \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u043e\u043c\u0443 \u0441\u043f\u043e\u0441\u043e\u0431\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u0442\u0440\u043e\u0433\u0438\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439. \u0422\u0430\u043a \u0447\u0442\u043e <i>std::vector::push_back</i> <a href=\"https://cplusplus.github.io/LWG/issue526\">\u043e\u0431\u044f\u0437\u0430\u043d</a> \u043f\u0440\u0438 \u0440\u0435\u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u0438:\n</p><ul><li>\u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c;\n</li><li>\u0437\u0430\u0442\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u043d\u0435\u0439 \u043d\u043e\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442;\n</li><li>\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u0441\u0442\u0430\u0440\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b;\n</li><li>\u0430 \u043f\u043e\u0441\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438 \u0441\u0442\u0430\u0440\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442\u044c.\n</li></ul><p>P.S. \u0410 \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0431\u044b\u043b 11 \u0432\u043e\u043f\u0440\u043e\u0441, \u0445\u043e\u0442\u044f \u043e\u0431\u0435\u0449\u0430\u043b\u0438 10? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432 C++ \u043c\u044b \u043b\u044e\u0431\u0438\u043c \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u041f\u0430\u0441\u0445\u0430\u043b\u043a\u0430 :)\n</p><p><br></p>", "en": "<p>Yes, you <a href=\"https://godbolt.org/z/93W19rvr7\">can do that</a>! The most remarkable rule in the standard guarantees this: nothing in the standard forbids it, yet nothing allows you to do this. Strict exception guarantees also play a role. So, on reallocation, <i>std::vector::push_back</i> <a href=\"https://cplusplus.github.io/LWG/issue526\">must</a> do the following:\n</p><ul><li>allocate memory;\n</li><li>place a new element there;\n</li><li>move old elements;\n</li><li>and then it can free the old memory.\n</li></ul><p>P.S. Why are there 11 questions when we promised 10? In C++, we're used to going beyond the array bounds :)\n</p><p><br></p>", "fr": "<p>Yes, you <a href=\"https://godbolt.org/z/93W19rvr7\">can do that</a>! The most remarkable rule in the standard guarantees this: nothing in the standard forbids it, yet nothing allows you to do this. Strict exception guarantees also play a role. So, on reallocation, <i>std::vector::push_back</i> <a href=\"https://cplusplus.github.io/LWG/issue526\">must</a> do the following:\n</p><ul><li>allocate memory;\n</li><li>place a new element there;\n</li><li>move old elements;\n</li><li>and then it can free the old memory.\n</li></ul><p>P.S. Why are there 11 questions when we promised 10? In C++, we're used to going beyond the array bounds :)\n</p><p><br></p>"}, "answers": [{"text": {"ru": "\u043d\u0435\u0442, \u043a\u043e\u043d\u0435\u0447\u043d\u043e. `push_back` \u0440\u0435\u0430\u043b\u043b\u043e\u0446\u0438\u0440\u0443\u0435\u0442 \u0432\u0435\u043a\u0442\u043e\u0440 \u0438 \u0438\u043d\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0443, \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435", "en": "no, of course not. The `push_back` function reallocates the vector and invalidates the reference\u2014there is undefined behavior", "fr": "no, of course not. The `push_back` function reallocates the vector and invalidates the reference\u2014there is undefined behavior"}, "value": 0}, {"text": {"ru": "\u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 `std::vector`", "en": "it depends on the `std::vector` implementation", "fr": "it depends on the `std::vector` implementation"}, "value": 0}, {"text": {"ru": "\u0434\u0430, \u043c\u043e\u0436\u043d\u043e. \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e", "en": "yep, it's okay. The standard guarantees that it'll be fine", "fr": "yep, it's okay. The standard guarantees that it'll be fine"}, "value": 1}], "image": {"ru": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-19_O6L7Wpw_thm__218x-.png", "fr": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-19_thm__218x-.png", "en": "https://wcdn.pvs-studio.com/media/quest/Kviz-neopredelennoe-povedenie-Reakcii-19_thm__218x-.png"}}], "results": [{"token": "1ff1de774005f8da13f42943881c655f", "score": 3, "image": {"ru": "https://wcdn.pvs-studio.com/media/quest/Kviz-rezultaty-pravki-Montazhnaja-oblast-1-kopija-17_thm__300x-.png", "fr": "https://wcdn.pvs-studio.com/media/quest/Kviz-Rezultaty-8_thm__300x-.png", "en": "https://wcdn.pvs-studio.com/media/quest/Kviz-Rezultaty-8_thm__300x-.png"}, "title": {"ru": "\u0423\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e", "en": "\u0421 grade", "fr": "\u0421 grade"}, "description": {"ru": "<h4>\u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u043a\u0442\u043e-\u0442\u043e \u043d\u0435 \u0447\u0438\u0442\u0430\u043b <a href=\"https://pvs-studio.ru/ru/blog/posts/cpp/1215/\">\u043d\u0430\u0448 \u0446\u0438\u043a\u043b \u0441\u0442\u0430\u0442\u0435\u0439</a>! \u0422\u0440\u043e\u0439\u043a\u0443 \u043f\u043e\u043a\u0430 \u0441\u0442\u0430\u0432\u0438\u043c \u043a\u0430\u0440\u0430\u043d\u0434\u0430\u0448\u043e\u043c, \u0434\u0430\u0451\u043c \u0448\u0430\u043d\u0441 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u043f\u044f\u0442\u0451\u0440\u043a\u0443 :) \u0427\u0438\u0442\u0430\u0439\u0442\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0438 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u0435 \u043a\u0432\u0438\u0437 \u0435\u0449\u0451 \u0440\u0430\u0437!</h4>\r\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043a\u0432\u0438\u0437\u0430 \u0432\u044b \u0432\u043e\u0437\u043c\u0443\u0449\u0435\u043d\u044b \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c\u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432. \u0422\u0430\u043a \u043d\u0438\u043a\u0442\u043e \u0438 \u043d\u0435 \u043e\u0431\u0435\u0449\u0430\u043b \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u043e\u0446\u0435\u043d\u043a\u0438 \u0437\u043d\u0430\u043d\u0438\u0439. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 — \u044d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0441\u043a\u043e\u0433\u043e \u044e\u043c\u043e\u0440\u0430 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0447\u043a\u043e\u0432 \u043d\u0430\u0431\u0435\u0440\u0451\u0442\u0435 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b, \u043d\u043e \u0438 \u0432\u0430\u0448\u0438 \u043a\u043e\u043b\u043b\u0435\u0433\u0438. \u041a\u0441\u0442\u0430\u0442\u0438, \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0441 \u043d\u0438\u043c\u0438 \u0441\u0441\u044b\u043b\u043a\u043e\u0439.</p>\r\n<p>\u0410 \u0435\u0441\u043b\u0438 \u0447\u0443\u0442\u044c \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u0435\u0435, \u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https://pvs-studio.ru/ru/blog/posts/cpp/1215/\">\u043f\u0443\u0442\u0435\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043f\u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e</a>, \u0435\u0441\u043b\u0438 \u0432\u044b \u0441 \u043d\u0438\u043c \u0435\u0449\u0451 \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b. \u0412 \u043d\u0451\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u044b \u0432\u0441\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0438\u0437 \u0437\u0430\u0434\u0430\u043d\u0438\u0439, \u0430 \u0435\u0449\u0451 \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043a\u0430\u043a \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u0443\u0436\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u0445 C++ \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432.</p>", "en": "<h4>Not quite there, but a good try. Looks like someone skipped the homework and didn't read <a href=\"https://pvs-studio.com/en/blog/posts/cpp/1215/\">our articles!</a> For now, that's a C, but you've got a chance to turn it into an S. Go back, reread our articles about undefined behavior, and try again! We'll wait...</h4>\r\n<p>After taking the quiz, you may feel a bit annoyed by the inaccurate questions and answer choices. Well, nobody promised any serious testing or knowledge assessment. What really matters is some programming humor and a chance to see how many points not only you, but also your colleagues can score. By the way, share the link with them.<br /><br />On a more serious note, now is a good time to read the <a href=\"https://pvs-studio.com/en/blog/posts/cpp/1215/\">guide to undefined behavior</a>, if you haven't already. It covers all the cases from the quiz and includes plenty of interesting and useful material for both beginners and experienced C++ developers.</p>", "fr": "<h4>Not quite there, but a good try. Looks like someone skipped the homework and didn't read <a href=\"https://pvs-studio.com/en/blog/posts/cpp/1215/\">our articles!</a> For now, that's a C, but you've got a chance to turn it into an S. Go back, reread our articles about undefined behavior, and try again! We'll wait...</h4>\r\n<p>After taking the quiz, you may feel a bit annoyed by the inaccurate questions and answer choices. Well, nobody promised any serious testing or knowledge assessment. What really matters is some programming humor and a chance to see how many points not only you, but also your colleagues can score. By the way, share the link with them.<br /><br />On a more serious note, now is a good time to read the <a href=\"https://pvs-studio.com/en/blog/posts/cpp/1215/\">guide to undefined behavior</a>, if you haven't already. It covers all the cases from the quiz and includes plenty of interesting and useful material for both beginners and experienced C++ developers.</p>"}}, {"token": "8e296a067a37563370ded05f5a3bf3ec", "score": 7, "image": {"ru": "https://wcdn.pvs-studio.com/media/quest/Kviz-rezultaty-pravki-Montazhnaja-oblast-1-kopija-16_thm__300x-.png", "fr": "https://wcdn.pvs-studio.com/media/quest/Kviz-Rezultaty-7_thm__300x-.png", "en": "https://wcdn.pvs-studio.com/media/quest/Kviz-Rezultaty-7_thm__300x-.png"}, "title": {"ru": "\u0425\u043e\u0440\u043e\u0448\u043e", "en": "B grade", "fr": "B grade"}, "description": {"ru": "<h4>\u0423\u043c\u043d\u044b\u0439, \u043d\u043e \u043b\u0435\u043d\u0438\u0432\u044b\u0439! \u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0432\u044b \u0447\u0438\u0442\u0430\u043b\u0438 \u043d\u0430\u0448\u0438 <a href=\"https://pvs-studio.ru/ru/blog/posts/cpp/1215/\">\u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435</a>, \u043d\u043e \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0433\u043b\u0430\u0432\u044b \u0443\u0441\u043f\u0435\u043b\u0438 \u0432\u044b\u043b\u0435\u0442\u0435\u0442\u044c \u0438\u0437 \u0433\u043e\u043b\u043e\u0432\u044b. \u0418\u043b\u0438 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043d\u0435\u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c? \u041e\u0441\u0432\u0435\u0436\u0438\u0442\u0435 \u0441\u0432\u043e\u044e \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u0435 \u043a\u0432\u0438\u0437 \u0435\u0449\u0451 \u0440\u0430\u0437!</h4>\r\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043a\u0432\u0438\u0437\u0430 \u0432\u044b \u0432\u043e\u0437\u043c\u0443\u0449\u0435\u043d\u044b \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c\u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432. \u0422\u0430\u043a \u043d\u0438\u043a\u0442\u043e \u0438 \u043d\u0435 \u043e\u0431\u0435\u0449\u0430\u043b \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u043e\u0446\u0435\u043d\u043a\u0438 \u0437\u043d\u0430\u043d\u0438\u0439. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 — \u044d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0441\u043a\u043e\u0433\u043e \u044e\u043c\u043e\u0440\u0430 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0447\u043a\u043e\u0432 \u043d\u0430\u0431\u0435\u0440\u0451\u0442\u0435 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b, \u043d\u043e \u0438 \u0432\u0430\u0448\u0438 \u043a\u043e\u043b\u043b\u0435\u0433\u0438. \u041a\u0441\u0442\u0430\u0442\u0438, \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0441 \u043d\u0438\u043c\u0438 \u0441\u0441\u044b\u043b\u043a\u043e\u0439.</p>\r\n<p>\u0410 \u0435\u0441\u043b\u0438 \u0447\u0443\u0442\u044c \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u0435\u0435, \u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https://pvs-studio.ru/ru/blog/posts/cpp/1215/\">\u043f\u0443\u0442\u0435\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043f\u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e</a>, \u0435\u0441\u043b\u0438 \u0432\u044b \u0441 \u043d\u0438\u043c \u0435\u0449\u0451 \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b. \u0412 \u043d\u0451\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u044b \u0432\u0441\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0438\u0437 \u0437\u0430\u0434\u0430\u043d\u0438\u0439, \u0430 \u0435\u0449\u0451 \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043a\u0430\u043a \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u0443\u0436\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u0445 C++ \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432.</p>", "en": "<h4>A smart cookie, but a bit lazy! We see you've skimmed our <a href=\"https://pvs-studio.com/en/blog/posts/cpp/1215/\">articles about undefined behavior</a>, but some stuff slipped through the cracks. Was it a case of daydreaming, or just staring out the window? Refresh your memory and give the quiz another shot!</h4>\r\n<p>After taking the quiz, you may feel a bit annoyed by the inaccurate questions and answer choices. Well, nobody promised any serious testing or knowledge assessment. What really matters is some programming humor and a chance to see how many points not only you, but also your colleagues can score. By the way, share the link with them.</p>\r\n<p>On a more serious note, now is a good time to read the <a href=\"https://pvs-studio.com/en/blog/posts/cpp/1215/\">guide to undefined behavior</a>, if you haven't already. It covers all the cases from the quiz and includes plenty of interesting and useful material for both beginners and experienced C++ developers.</p>", "fr": "<h4>A smart cookie, but a bit lazy! We see you've skimmed our <a href=\"https://pvs-studio.com/en/blog/posts/cpp/1215/\">articles about undefined behavior</a>, but some stuff slipped through the cracks. Was it a case of daydreaming, or just staring out the window? Refresh your memory and give the quiz another shot!</h4>\r\n<p>After taking the quiz, you may feel a bit annoyed by the inaccurate questions and answer choices. Well, nobody promised any serious testing or knowledge assessment. What really matters is some programming humor and a chance to see how many points not only you, but also your colleagues can score. By the way, share the link with them.</p>\r\n<p>On a more serious note, now is a good time to read the <a href=\"https://pvs-studio.com/en/blog/posts/cpp/1215/\">guide to undefined behavior</a>, if you haven't already. It covers all the cases from the quiz and includes plenty of interesting and useful material for both beginners and experienced C++ developers.</p>"}}, {"token": "4e732ced3463d06de0ca9a15b6153677", "score": 10, "image": {"ru": "https://wcdn.pvs-studio.com/media/quest/Kviz-rezultaty-pravki-Montazhnaja-oblast-1-kopija-15_thm__300x-.png", "fr": "https://wcdn.pvs-studio.com/media/quest/Kviz-Rezultaty-6_thm__300x-.png", "en": "https://wcdn.pvs-studio.com/media/quest/Kviz-Rezultaty-6_thm__300x-.png"}, "title": {"ru": "\u041e\u0442\u043b\u0438\u0447\u043d\u043e", "en": "A grade", "fr": "A grade"}, "description": {"ru": "<h4>\u041c\u043e\u043b\u043e\u0434\u0435\u0446! \u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043a \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044e \u043a\u0432\u0438\u0437\u0430 \u0432\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438\u0441\u044c \u043e\u0441\u043d\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u0418 <a href=\"https://pvs-studio.ru/ru/blog/posts/cpp/1215/\">\u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0430\u0448\u0438</a>, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u043d\u0430\u0438\u0437\u0443\u0441\u0442\u044c \u0437\u0430\u0443\u0447\u0438\u043b\u0438? \u0421\u0430\u0434\u0438\u0441\u044c, \u0437\u0430\u0441\u043b\u0443\u0436\u0435\u043d\u043d\u0430\u044f \u043f\u044f\u0442\u0451\u0440\u043a\u0430!</h4>\r\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043a\u0432\u0438\u0437\u0430 \u0432\u044b \u0432\u043e\u0437\u043c\u0443\u0449\u0435\u043d\u044b \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c\u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432. \u0422\u0430\u043a \u043d\u0438\u043a\u0442\u043e \u0438 \u043d\u0435 \u043e\u0431\u0435\u0449\u0430\u043b \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u043e\u0446\u0435\u043d\u043a\u0438 \u0437\u043d\u0430\u043d\u0438\u0439. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 — \u044d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0441\u043a\u043e\u0433\u043e \u044e\u043c\u043e\u0440\u0430 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0447\u043a\u043e\u0432 \u043d\u0430\u0431\u0435\u0440\u0451\u0442\u0435 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b, \u043d\u043e \u0438 \u0432\u0430\u0448\u0438 \u043a\u043e\u043b\u043b\u0435\u0433\u0438. \u041a\u0441\u0442\u0430\u0442\u0438, \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0441 \u043d\u0438\u043c\u0438 \u0441\u0441\u044b\u043b\u043a\u043e\u0439.</p>\r\n<p>\u0410 \u0435\u0441\u043b\u0438 \u0447\u0443\u0442\u044c \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u0435\u0435, \u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https://pvs-studio.ru/ru/blog/posts/cpp/1215/\">\u043f\u0443\u0442\u0435\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043f\u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e</a>, \u0435\u0441\u043b\u0438 \u0432\u044b \u0441 \u043d\u0438\u043c \u0435\u0449\u0451 \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b. \u0412 \u043d\u0451\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u044b \u0432\u0441\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0438\u0437 \u0437\u0430\u0434\u0430\u043d\u0438\u0439, \u0430 \u0435\u0449\u0451 \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043a\u0430\u043a \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u0443\u0436\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u0445 C++ \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432.</p>", "en": "<h4>Well done! Bet you stayed up all night cramming for this, huh? Looks like you've just memorized <a href=\"https://pvs-studio.com/en/blog/posts/cpp/1215/\">our articles</a>. Take a seat, that's a solid A!</h4>\r\n<p>After taking the quiz, you may feel a bit annoyed by the inaccurate questions and answer choices. Well, nobody promised any serious testing or knowledge assessment. What really matters is some programming humor and a chance to see how many points not only you, but also your colleagues can score. By the way, share the link with them.</p>\r\n<p>On a more serious note, now is a good time to read the <a href=\"https://pvs-studio.com/en/blog/posts/cpp/1215/\">guide to undefined behavior</a>, if you haven't already. It covers all the cases from the quiz and includes plenty of interesting and useful material for both beginners and experienced C++ developers.</p>", "fr": "<h4>Well done! Bet you stayed up all night cramming for this, huh? Looks like you've just memorized <a href=\"https://pvs-studio.com/en/blog/posts/cpp/1215/\">our articles</a>. Take a seat, that's a solid A!</h4>\r\n<p>After taking the quiz, you may feel a bit annoyed by the inaccurate questions and answer choices. Well, nobody promised any serious testing or knowledge assessment. What really matters is some programming humor and a chance to see how many points not only you, but also your colleagues can score. By the way, share the link with them.</p>\r\n<p>On a more serious note, now is a good time to read the <a href=\"https://pvs-studio.com/en/blog/posts/cpp/1215/\">guide to undefined behavior</a>, if you haven't already. It covers all the cases from the quiz and includes plenty of interesting and useful material for both beginners and experienced C++ developers.</p>"}}, {"token": "02e74f10e0327ad868d138f2b4fdd6f0", "score": 11, "image": {"ru": "https://wcdn.pvs-studio.com/media/quest/Kviz-rezultaty-pravki-Montazhnaja-oblast-1-kopija-14_thm__300x-.png", "fr": "https://wcdn.pvs-studio.com/media/quest/Kviz-Rezultaty-5_thm__300x-.png", "en": "https://wcdn.pvs-studio.com/media/quest/Kviz-Rezultaty-5_thm__300x-.png"}, "title": {"ru": "\u041f\u044f\u0442\u044c \u0441 \u043f\u043b\u044e\u0441\u043e\u043c", "en": "Superb!", "fr": "Superb!"}, "description": {"ru": "<h4>\u0414\u0430 \u0443 \u043d\u0430\u0441 \u0441\u0440\u0430\u0437\u0443 \u0434\u0432\u0430 \u0443\u0447\u0438\u0442\u0435\u043b\u044f \u0432 \u043a\u043b\u0430\u0441\u0441\u0435! \u0412\u043e\u0442 \u044d\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 — \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430! \u041c\u044b \u0432\u043e\u0441\u0445\u0438\u0449\u0430\u0435\u043c\u0441\u044f \u0432\u0430\u0448\u0438\u043c\u0438 \u0437\u043d\u0430\u043d\u0438\u044f\u043c\u0438 \u043e <a href=\"https://pvs-studio.ru/ru/blog/posts/cpp/1215/\">\u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438</a> \u0438 \u0441\u0442\u0430\u0432\u0438\u043c \u0437\u0430\u0441\u043b\u0443\u0436\u0435\u043d\u043d\u0443\u044e \u043f\u044f\u0442\u0451\u0440\u043a\u0443 \u0441 \u043f\u043b\u044e\u0441\u043e\u043c!</h4>\r\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043a\u0432\u0438\u0437\u0430 \u0432\u044b \u0432\u043e\u0437\u043c\u0443\u0449\u0435\u043d\u044b \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c\u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432. \u0422\u0430\u043a \u043d\u0438\u043a\u0442\u043e \u0438 \u043d\u0435 \u043e\u0431\u0435\u0449\u0430\u043b \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u043e\u0446\u0435\u043d\u043a\u0438 \u0437\u043d\u0430\u043d\u0438\u0439. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 — \u044d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0441\u043a\u043e\u0433\u043e \u044e\u043c\u043e\u0440\u0430 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0447\u043a\u043e\u0432 \u043d\u0430\u0431\u0435\u0440\u0451\u0442\u0435 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b, \u043d\u043e \u0438 \u0432\u0430\u0448\u0438 \u043a\u043e\u043b\u043b\u0435\u0433\u0438. \u041a\u0441\u0442\u0430\u0442\u0438, \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0441 \u043d\u0438\u043c\u0438 \u0441\u0441\u044b\u043b\u043a\u043e\u0439.</p>\r\n<p>\u0410 \u0435\u0441\u043b\u0438 \u0447\u0443\u0442\u044c \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u0435\u0435, \u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https://pvs-studio.ru/ru/blog/posts/cpp/1215/\">\u043f\u0443\u0442\u0435\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043f\u043e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e</a>, \u0435\u0441\u043b\u0438 \u0432\u044b \u0441 \u043d\u0438\u043c \u0435\u0449\u0451 \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b. \u0412 \u043d\u0451\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u044b \u0432\u0441\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0438\u0437 \u0437\u0430\u0434\u0430\u043d\u0438\u0439, \u0430 \u0435\u0449\u0451 \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043a\u0430\u043a \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u0443\u0436\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u0445 C++ \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432.</p>", "en": "<h4>Oh gosh, here's a valedictorian in the classroom—11 out of 11! You're the class genius when it comes to <a href=\"https://pvs-studio.com/en/blog/posts/cpp/1215/\">undefined behavior</a>. That's a well-earned S—excellent work!</h4>\r\n<p>After taking the quiz, you may feel a bit annoyed by the inaccurate questions and answer choices. Well, nobody promised any serious testing or knowledge assessment. What really matters is some programming humor and a chance to see how many points not only you, but also your colleagues can score. By the way, share the link with them.</p>\r\n<p>On a more serious note, now is a good time to read the <a href=\"https://pvs-studio.com/en/blog/posts/cpp/1215/\">guide to undefined behavior</a>, if you haven't already. It covers all the cases from the quiz and includes plenty of interesting and useful material for both beginners and experienced C++ developers.</p>", "fr": "<h4>Oh gosh, here's a valedictorian in the classroom—11 out of 11! You're the class genius when it comes to <a href=\"https://pvs-studio.com/en/blog/posts/cpp/1215/\">undefined behavior</a>. That's a well-earned S—excellent work!</h4>\r\n<p>After taking the quiz, you may feel a bit annoyed by the inaccurate questions and answer choices. Well, nobody promised any serious testing or knowledge assessment. What really matters is some programming humor and a chance to see how many points not only you, but also your colleagues can score. By the way, share the link with them.</p>\r\n<p>On a more serious note, now is a good time to read the <a href=\"https://pvs-studio.com/en/blog/posts/cpp/1215/\">guide to undefined behavior</a>, if you haven't already. It covers all the cases from the quiz and includes plenty of interesting and useful material for both beginners and experienced C++ developers.</p>"}}]}
True