1. <tfoot id='o4QyB'></tfoot>
        <bdo id='o4QyB'></bdo><ul id='o4QyB'></ul>

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

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

        包含 .cpp 而不是 header(.h)

        Include .cpp instead of header(.h)(包含 .cpp 而不是 header(.h))
        • <i id='IAh3q'><tr id='IAh3q'><dt id='IAh3q'><q id='IAh3q'><span id='IAh3q'><b id='IAh3q'><form id='IAh3q'><ins id='IAh3q'></ins><ul id='IAh3q'></ul><sub id='IAh3q'></sub></form><legend id='IAh3q'></legend><bdo id='IAh3q'><pre id='IAh3q'><center id='IAh3q'></center></pre></bdo></b><th id='IAh3q'></th></span></q></dt></tr></i><div id='IAh3q'><tfoot id='IAh3q'></tfoot><dl id='IAh3q'><fieldset id='IAh3q'></fieldset></dl></div>
            <bdo id='IAh3q'></bdo><ul id='IAh3q'></ul>
            <legend id='IAh3q'><style id='IAh3q'><dir id='IAh3q'><q id='IAh3q'></q></dir></style></legend>

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

                <tbody id='IAh3q'></tbody>
                  <tfoot id='IAh3q'></tfoot>
                  本文介绍了包含 .cpp 而不是 header(.h)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在某些情况下,我们包含 .cpp 文件而不是标准头文件 (.h),例如:

                  There are some cases when we include .cpp file instead of standard header file (.h), for example:

                  #include "example.cpp"
                  

                  代替

                  #include "example.h"
                  

                  它似乎有效,但这是否安全还是我应该避免它?

                  It seems to work but is this safe or should I avoid it?

                  编译时间呢?

                  推荐答案

                  这是懒惰的编码.使用头文件.是的,它们可以增加编译时间,但它们意味着您可以轻松地重新实现代码块,或者更好的是,其他开发人员可以随时重新实现.头文件用作 C/C++ 代码将要执行的操作的模板.丢弃或忽略它是一个坏主意.

                  It's lazy coding. Use header files. Yes they can increase compile time but they mean that you can easily re-implement chunks of your code, or better yet, another developer could at anytime. The header file serves as a template for what your C/C++ code is going to do. It's a bad idea to discard or ignore it.

                  这篇关于包含 .cpp 而不是 header(.h)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What is inside .lib file of Static library, Statically linked dynamic library and dynamically linked dynamic library?(静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么?)
                  How do I load a C DLL from the SXS in Python?(如何从 Python 中的 SXS 加载 C DLL?)
                  Can Cython code be compiled to a dll so C++ application can call it?(Cython 代码可以编译成 dll 以便 C++ 应用程序可以调用它吗?)
                  Delay Loading DLLs(延迟加载 DLL)
                  Throwing C++ exceptions across DLL boundaries(跨 DLL 边界抛出 C++ 异常)
                  Loading a dll from a dll?(从 dll 加载 dll?)
                1. <small id='EnkUs'></small><noframes id='EnkUs'>

                    <bdo id='EnkUs'></bdo><ul id='EnkUs'></ul>
                      <tbody id='EnkUs'></tbody>

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

                            <tfoot id='EnkUs'></tfoot>