compiler-flags

Xcode 5 equivalent of NS_BLOCK_ASSERTIONS in Build Settings

北城以北 提交于 2019-11-28 09:59:45
Until Xcode 5, Release builds could be prevented from including NSAssert statements and their variants, using the default Build Setting: OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; This setting can be found in project.pbxproj and is set in Xcode here: (Note that this grab was taken from an Xcode 4 project converted to Xcode 5.) Each target would inherit this setting in the Release build only. Obviously this was a good thing. Rather than crash immediately, the app would possibly struggle on regardless. Whereas for Debug builds, you want to know immediately when an NSAssert fails. However, I am

What does the “Prefer 32-bit” compiler flag mean for Visual Studio (C#, VB)?

﹥>﹥吖頭↗ 提交于 2019-11-28 08:06:27
Just got the Visual Studio 11 developer preview installed. I see a new option in the project properties called "Prefer 32-bit" when compiling a managed (C#, VB) application with the AnyCPU target specified. This doesn't appear to be an option for class libraries, just top-level apps. What does this flag indicate? It likely indicates the app is AnyCpu but when 32 bit is available it shouold run as such. This makes sense - 64 bit apps use more memory, and sometimes you just dont need the memory space ;) EDIT: Application compiled with "Any CPU 32-bit preferred" is compatible with x86, x64 and

Changing CMAKE_CXX_FLAGS in project

江枫思渺然 提交于 2019-11-28 07:10:37
I have the following content in my CMakeLists.txt: project( Matfile ) SET ( CMAKE_CXX_FLAGS "-std=c++0x" ) set ( SOURCES "foo.cpp" "bar.cpp" ) add_library( Matfile ${SOURCES} ) As you may imagine, what I want to do is to compile my C++ sources using the flag -std=c++0x (I'm using gcc and I need the C++11 features). Unfortunately, this does not work, in the sense that, when I use cmake to generate the makefiles, the variable CMAKE_CXX_FLAGS is completely void. How can I set this variable in the project file? It seems to be a very stupid question, but I just spent not less than two houres trying

How does gcc's -pg flag work?

拥有回忆 提交于 2019-11-28 05:01:14
I'm trying to understand how the -pg (or -p ) flag works when compiling C code with gcc . The official gcc documentation only states : -pg Generate extra code to write profile information suitable for the analysis program gprof. You must use this option when compiling the source files you want data about, and you must also use it when linking. This really interests me, as I'm doing a small research on profilers - trying to pick the best tool for the job. Gregory Pakosz Compiling with -pg instruments your code so that gprof reports detailed information, see gprof's manual, 9.1 Implementation of

Using compiler variables in Swift

不问归期 提交于 2019-11-28 03:59:21
问题 In Objective-C I had a bunch of compiler flags set in Build Settings -> Other C Flags that were being used in the code. For instance: Flag => -DPortNumber = 1 And in code I was able to access it by @(PortNumber) This doesn't work in Swift, and I'm not able to find an answer. 回答1: The -D flag to C compilers defines a preprocessor macro. There are no preprocessor macros in Swift. So if you're looking to do something like: // compile with -DPORT_NUMBER 31337 var port = PORT_NUMBER // error ...

What's the “DNS_BLOCK_ASSERTIONS” (C compiler flag)?

血红的双手。 提交于 2019-11-27 20:50:49
问题 What's the "DNS_BLOCK_ASSERTIONS" (C compiler flag)? 回答1: The NS_BLOCK_ASSERTIONS macro (no "D") suppresses the checks performed by NSAssert. You supply it to the compiler using -DNS_BLOCK_ASSERTIONS (see the comments for an explanation of the "D"). 来源: https://stackoverflow.com/questions/2752574/whats-the-dns-block-assertions-c-compiler-flag

GCC optimization flags for matrix/vector operations

你离开我真会死。 提交于 2019-11-27 20:37:01
问题 I am performing matrix operations using C. I would like to know what are the various compiler optimization flags to improve speed of execution of these matrix operations for double and int64 data - like Multiplication, Inverse, etc. I am not looking for hand optimized code, I just want to make the native code more faster using compiler flags and learn more about these flags. The flags that I have found so far which improve matrix code. -O3/O4 -funroll-loops -ffast-math 回答1: First of all, I

Specific compiler flags for specific files in Xcode

二次信任 提交于 2019-11-27 18:05:46
问题 I've been tasked to work on a project that has some confusing attributes. The project is of the nature that it won't compile for the iPhone Simulator And the iPhone Device with the same compile settings. I think it has to do with needing to be specifically compiled for x86 or arm6/7 depending on the target platform. So the project's build settings, when viewed in Xcode's Build Settings view doesn't enable me to set specific compiler flags per specific files. However, the previous developer

Which compilation flags should I use to avoid run time errors

和自甴很熟 提交于 2019-11-27 16:33:03
问题 Just learned here that -Wsequence-point comiplation flag will pop a warning when the code can invoke UB. I tried it on a statement like int x = 1; int y = x+ ++x; and it worked very nicely. Until now I have compiled with gcc or g++ only using -ansi -pedantic -Wall . Do you have any other helpful flags to make the code more safe and robust? 回答1: As alk summed up, use these flags: -pedantic -Wall -Wextra -Wconversion First, I think you don't want to use the -ansi flag, as suggested in Should I

gcc optimization flags for Xeon?

社会主义新天地 提交于 2019-11-27 09:51:09
问题 I'd want your input which gcc compiler flags to use when optimizing for Xeons? There's no 'xeon' in mtune or march so which is the closest match? 回答1: Xeon is a marketing term, as such it covers a long list of processors with very different internals. If you meant the newer Nehalem processors (Core i7) then this slide indicates that as of 4.3.1 gcc should be use -march=generic (though your own testing of your own app may find other settings that outperform this). The 4.3 series also added