<tfoot id='e4bF0'></tfoot>
    1. <small id='e4bF0'></small><noframes id='e4bF0'>

    2. <i id='e4bF0'><tr id='e4bF0'><dt id='e4bF0'><q id='e4bF0'><span id='e4bF0'><b id='e4bF0'><form id='e4bF0'><ins id='e4bF0'></ins><ul id='e4bF0'></ul><sub id='e4bF0'></sub></form><legend id='e4bF0'></legend><bdo id='e4bF0'><pre id='e4bF0'><center id='e4bF0'></center></pre></bdo></b><th id='e4bF0'></th></span></q></dt></tr></i><div id='e4bF0'><tfoot id='e4bF0'></tfoot><dl id='e4bF0'><fieldset id='e4bF0'></fieldset></dl></div>

        <legend id='e4bF0'><style id='e4bF0'><dir id='e4bF0'><q id='e4bF0'></q></dir></style></legend>
          <bdo id='e4bF0'></bdo><ul id='e4bF0'></ul>
      1. 未定义的行为可以擦除硬盘驱动器吗?

        时间:2023-09-15
            <tbody id='DrX0E'></tbody>

              <bdo id='DrX0E'></bdo><ul id='DrX0E'></ul>

            • <i id='DrX0E'><tr id='DrX0E'><dt id='DrX0E'><q id='DrX0E'><span id='DrX0E'><b id='DrX0E'><form id='DrX0E'><ins id='DrX0E'></ins><ul id='DrX0E'></ul><sub id='DrX0E'></sub></form><legend id='DrX0E'></legend><bdo id='DrX0E'><pre id='DrX0E'><center id='DrX0E'></center></pre></bdo></b><th id='DrX0E'></th></span></q></dt></tr></i><div id='DrX0E'><tfoot id='DrX0E'></tfoot><dl id='DrX0E'><fieldset id='DrX0E'></fieldset></dl></div>

                • <tfoot id='DrX0E'></tfoot><legend id='DrX0E'><style id='DrX0E'><dir id='DrX0E'><q id='DrX0E'></q></dir></style></legend>

                • <small id='DrX0E'></small><noframes id='DrX0E'>

                • 本文介绍了未定义的行为可以擦除硬盘驱动器吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  来自Scott Meyers 撰写的《Effective C++ 3rd edition》":

                  <块引用>

                  为了强调未定义行为的结果是不可预测的,并且可能会非常不愉快,有经验的 C++ 程序员经常说具有未定义行为的程序会擦除您的硬盘驱动器.

                  在什么情况下会发生这种情况?

                  例如,访问和写入数组范围之外的位置是否会损坏不属于此 C++ 程序或线程的内存?

                  解决方案

                  可以吗?当然.事实上发生在我身上.

                  我编写了删除临时目录的代码.这涉及创建一个 recursive delete *.* 命令.由于一个错误, 字段并不总是被填充.我们的文件系统代码愉快地执行了 recursive delete *.* 命令.>

                  我的同事注意到桌面上的图标突然消失了.拿出两台机器.

                  From "Effective C++ 3rd edition by Scott Meyers":

                  To emphasize that the results of undefined behavior are not predictable and may be very unpleasant, experienced C++ programmers often say that programs with undefined behavior can erase your hard drive.

                  Under what circumstances can this happen?

                  For example, can accessing and writing to locations out of array range corrupt memory that doesn't belong to this C++ program or thread?

                  解决方案

                  Can it? Sure. Happened to me, in fact.

                  I wrote code to delete a temporary directory. That involved creating a recursive delete <temp directory>*.* command. Due to a bug, the <temp directory> field wasn't always filled in. Our file system code happily executed the recursive delete *.* command.

                  My colleagues noticed when the icons on their desktop suddenly disappeared. Took out two machines.

                  这篇关于未定义的行为可以擦除硬盘驱动器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:你能在 c 或 c++ 中分配一个非常大的单个内存块 下一篇:C++中对象是如何存储在内存中的?

                  相关文章

                  最新文章

                  <i id='PP49C'><tr id='PP49C'><dt id='PP49C'><q id='PP49C'><span id='PP49C'><b id='PP49C'><form id='PP49C'><ins id='PP49C'></ins><ul id='PP49C'></ul><sub id='PP49C'></sub></form><legend id='PP49C'></legend><bdo id='PP49C'><pre id='PP49C'><center id='PP49C'></center></pre></bdo></b><th id='PP49C'></th></span></q></dt></tr></i><div id='PP49C'><tfoot id='PP49C'></tfoot><dl id='PP49C'><fieldset id='PP49C'></fieldset></dl></div>
                  • <bdo id='PP49C'></bdo><ul id='PP49C'></ul>

                    <tfoot id='PP49C'></tfoot>

                    <small id='PP49C'></small><noframes id='PP49C'>

                    <legend id='PP49C'><style id='PP49C'><dir id='PP49C'><q id='PP49C'></q></dir></style></legend>