什么是GCC_NO_COMMON_BLOCKS用于? [英] What is GCC_NO_COMMON_BLOCKS used for?

查看:449
本文介绍了什么是GCC_NO_COMMON_BLOCKS用于?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现我的项目设置

  GCC_NO_COMMON_BLOCKS = NO 


Apple LLVM编译器3.1 - 代码生成设置,如无公共块





我想知道:该标志用于什么?



非常感谢

解决方案

来自Xcode的快速帮助:


在C中,在对象的数据部分
中分配甚至未初始化的全局变量文件,而不是将它们生成为公共块。
这样做的结果是,如果在两个不同的编译中声明了相同的变量(没有
extern),当你用
链接它们时会出现错误。这可能是有用的唯一原因是如果你希望
验证该程序将在其他系统上工作,这些系统总是以这种方式工作


您可以在右侧窗格的显示快速帮助检查器选项卡下找到快速帮助:


I found that my project sets

GCC_NO_COMMON_BLOCKS = NO 

under Apple LLVM Compiler 3.1 - Code Generation settings, as "No Common Blocks"

I would like to know: what is that flag used for?

Thanks a lot

解决方案

From Xcode's quick help:

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.

You can find the quick help in the right pane, under the "Show Quick Help Inspector" tab:

这篇关于什么是GCC_NO_COMMON_BLOCKS用于?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆