gpt4 book ai didi

include - #pragma once 与 #if !defined MYHEADER_INCLUDED_

转载 作者:行者123 更新时间:2023-12-04 00:04:55 25 4
gpt4 key购买 nike

这个问题在这里已经有了答案:




9年前关闭。




Possible Duplicate:
#pragma once vs include guards?



使用 #pragma once 有什么区别(在性能、可用​​性和功能方面)和 #if !defined MYHEADER_INCLUDED_结构体?或者两者有什么区别?

最佳答案

维基百科有你所有的答案,很容易找到

From the article

In the C and C++ programming languages, #pragma once is a non-standard but widely supported preprocessor directive designed to cause the current source file to be included only once in a single compilation.

Thus, #pragma once serves the same purpose as #include guards, but with several advantages, including: less code, avoiding name clashes, and improved compile speed.



它更深入地了解了 article 中的优缺点。 .如果你真的有兴趣,我建议你完整地阅读它,而不仅仅是上面的介绍。

关于include - #pragma once 与 #if !defined MYHEADER_INCLUDED_,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2964100/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com