xcode GCC_NO_COMMON_BLOCKS 用于什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11233235/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is GCC_NO_COMMON_BLOCKS used for?
提问by Lio
I found that my project sets
我发现我的项目集
GCC_NO_COMMON_BLOCKS = NO
under Apple LLVM Compiler 3.1 - Code Generation settings, as "No Common Blocks"
在 Apple LLVM Compiler 3.1 - Code Generation 设置下,作为“No Common Blocks”
I would like to know: what is that flag used for?
我想知道:那个标志是干什么用的?
Thanks a lot
非常感谢
回答by JustSid
From Xcode's quick help:
来自 Xcode 的快速帮助:
In C, allocate even uninitialized global variables in the data section of the object file, rather than generating them as common blocks. This has the effect that if the same variable is declared (without extern ) in two different compilations, you will get an error when you link them. The only reason this might be useful is if you wish to verify that the program will work on other systems which always work this way.
在 C 中,甚至在目标文件的数据部分分配未初始化的全局变量,而不是将它们生成为公共块。这会导致如果在两个不同的编译中声明了相同的变量(没有 extern ),则在链接它们时会出现错误。这可能有用的唯一原因是,如果您希望验证该程序是否可以在始终以这种方式工作的其他系统上运行。
You can find the quick help in the right pane, under the "Show Quick Help Inspector" tab:
您可以在右侧窗格中的“显示快速帮助检查器”选项卡下找到快速帮助: