compiler-options

How to disable narrowing conversion warnings?

冷暖自知 提交于 2019-11-28 07:09:26
问题 I use -Wall and updating to new gcc I have got a lot of warning: narrowing conversion . I want to disable them, but leave all other warnings untouched (ideally). I can find nothing about narrowing in http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html How to disable narrowing conversion warnings? Is it possible at all? P.S. I need to Disable warnings, not fix them in the source code. Blind -Wno-conversion doesn't help. 回答1: As gx_ said, adding -Wno-narrowing to your command line should

How to disable compiler optimizations in gcc?

人盡茶涼 提交于 2019-11-28 03:14:49
I am trying to learn assembly language. I have searched and found how to disassemble a .c file but I think it produces some optimized version of the program. Is there any way so that I can see the exact assembly code which corresponds to my C file. The gcc option -O enables different levels of optimization. Use -O0 to disable them and use -S to output assembly. -O3 is the highest level of optimization. Starting with gcc 4.8 the optimization level -Og is available. It enables optimizations that do not interfere with debugging and is the recommended default for the standard edit-compile-debug

How can I understand the fdump-class-hierarchy output

人走茶凉 提交于 2019-11-27 21:25:06
问题 I'm playing with fdump-class-hierarchy compiler option but I don't know how I can understand the output. What does the "size", "align", "base size" and "base align" mean, and how these are counted? Thanks! When the code is: class A { public: private: double m_nothing; int m_number; }; The output is: Class A size=16 align=8 base size=16 base align=8 A (0x406c690) 0 But, if I change the class a little: class A { public: private: int m_number; double m_nothing; }; the output will be: Class A

Difference between add_compile_options and SET(CMAKE_CXX_FLAGS…)

大憨熊 提交于 2019-11-27 19:06:10
This question is related to Instruct Cmake to use CXX and CXXFLAGS when driving link? In the former question, we are trying to instruct CMake to use CXXFLAGS when it invokes the linker. add_compile_options We found that the following code if (CMAKE_VERSION VERSION_LESS 2.8.12) add_definitions(-foo) else() add_compile_options(-foo) endif() message(STATUS, "CXXFLAGS: ${CMAKE_CXX_FLAGS}") produces the output CXXFLAGS: SET CMAKE_CXX_FLAGS We found that the following code SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -foo" ) message(STATUS, "CXXFLAGS: ${CMAKE_CXX_FLAGS}") produces the output CXXFLAGS:

“Register for COM Interop” vs “Make assembly COM visible”

泪湿孤枕 提交于 2019-11-27 17:09:38
What is the real difference between these two options? What I know is: Register for COM Interop This options executes regasm on the assembly and registers the assembly as an COM component(or maybe not) in the registry with all COM like registry entries. Does this step generates a TLB file? What else is done? Sometimes I see a tlb is generated when I compile the project but sometimes not, why is this? Make assembly COM visible What effect does this one has on an assembly? If I have the following type inside this assembly, do I still need to specify the "Make assembly COM Visible" even though my

Can I use Java annotations to define compile time checks?

拜拜、爱过 提交于 2019-11-27 16:19:27
问题 For example, I wanted to create the annotation @Out to target parameters. Then I would somehow use the compiler to check if the parameter value is set before the function returns. Is this possible? Also was thinking about a @Immutable annotation that would not allow any method not annotaded with @Const to be invoked or access to any public fields. (compile time and probably runtime?) So far I have this: //I'm assuming Class retention is a subset of Runtime retention @Retention(RetentionPolicy

Break in Class Module vs. Break on Unhandled Errors (VB6 Error Trapping, Options Setting in IDE)

时光毁灭记忆、已成空白 提交于 2019-11-27 09:43:01
Basically, I'm trying to understand the difference between the "Break in Class Module" and "Break on Unhandled Errors" that appear in the Visual Basic 6.0 IDE under the following path: Tools --> Options --> General --> Error Trapping The three options appear to be: Break on All Errors Break in Class Module Break on Unhandled Errors Now, apparently, according to MSDN, the second option (Break in Class Module) really just means "Break on Unhandled Errors in Class Modules". Also, this option appears to be set by default (ie: I think its set to this out of the box). What I am trying to figure out

Disabling C++0x features in VC 2010?

依然范特西╮ 提交于 2019-11-27 07:39:39
问题 Does C++0x mode in VC++ 2010 has an off switch? I am working on a project that supposed to compile on non 0x compilers, and therefore I want to compile against the current standard. (Even if non of the new features are being used directly, there are still subtleties that makes C++0x more premissive). The closest switch I found was Configuration Properties -> C/C++ -> Language -> Disable Language Extensions but that's not it. 回答1: No, language extensions are typically non-standard vendor

Difference between add_compile_options and SET(CMAKE_CXX_FLAGS…)

最后都变了- 提交于 2019-11-27 04:20:50
问题 This question is related to Instruct Cmake to use CXX and CXXFLAGS when driving link? In the former question, we are trying to instruct CMake to use CXXFLAGS when it invokes the linker. add_compile_options We found that the following code if (CMAKE_VERSION VERSION_LESS 2.8.12) add_definitions(-foo) else() add_compile_options(-foo) endif() message(STATUS, "CXXFLAGS: ${CMAKE_CXX_FLAGS}") produces the output CXXFLAGS: SET CMAKE_CXX_FLAGS We found that the following code SET(CMAKE_CXX_FLAGS "$

What is the difference between the /Ox and /O2 compiler options?

混江龙づ霸主 提交于 2019-11-27 03:48:16
Microsoft's C++ compiler ( cl.exe , as included with Visual Studio) offers several optimization switches . The difference between most of them seems self-explanatory, but it's not clear to me what the difference is between /O2 (which optimizes code for maximum speed) and /Ox (which selects "full optimization"). I've tried reading the documentation for the /Ox option, and it seems to confirm that this switch also enables optimizations for maximum speed, rather than size: The /Ox compiler option produces code that favors execution speed over smaller size. But in particular, the following