conditional-compilation

What is the difference between Release and Debug modes in Visual Studio? [duplicate]

社会主义新天地 提交于 2019-11-26 15:04:56
Possible Duplicate: Debug vs. release in .NET Debug/Release difference What is the difference between Release and Debug modes in Visual Studio while building a project? Well, it depends on what language you are using, but in general they are 2 separate configurations, each with its own settings. By default, Debug includes debug information in the compiled files (allowing easy debugging) while Release usually has optimizations enabled. As far as conditional compilation goes, they each define different symbols that can be checked in your program, but they are language-specific macros. Debug and

Java conditional compilation: how to prevent code chunks from being compiled?

有些话、适合烂在心里 提交于 2019-11-26 14:34:13
My project requires Java 1.6 for compilation and running. Now I have a requirement to make it working with Java 1.5 (from the marketing side). I want to replace method body (return type and arguments remain the same) to make it compiling with Java 1.5 without errors. Details: I have an utility class called OS which encapsulates all OS-specific things. It has a method public static void openFile(java.io.File file) throws java.io.IOException { // open the file using java.awt.Desktop ... } to open files like with double-click ( start Windows command or open Mac OS X command equivalent). Since it

What #defines are set up by Xcode when compiling for iPhone

余生颓废 提交于 2019-11-26 11:51:11
问题 I\'m writing some semi-portable code and want to be able to detect when I\'m compiling for iPhone. So I want something like #ifdef IPHONE_SDK... . Presumably Xcode defines something, but I can\'t see anything under project properties, and Google isn\'t much help. 回答1: It's in the SDK docs under "Compiling source code conditionally" The relevant definitions are TARGET_OS_IPHONE (and he deprecated TARGET_IPHONE_SIMULATOR), which are defined in /usr/include/TargetConditionals.h within the iOS

Determining 32 vs 64 bit in C++

折月煮酒 提交于 2019-11-26 11:34:11
I'm looking for a way to reliably determine whether C++ code is being compiled in 32 vs 64 bit. We've come up with what we think is a reasonable solution using macros, but was curious to know if people could think of cases where this might fail or if there is a better way to do this. Please note we are trying to do this in a cross-platform, multiple compiler environment. #if ((ULONG_MAX) == (UINT_MAX)) # define IS32BIT #else # define IS64BIT #endif #ifdef IS64BIT DoMy64BitOperation() #else DoMy32BitOperation() #endif Thanks. Unfortunately there is no cross platform macro which defines 32 / 64

Conditional compilation depending on the framework version in C#

末鹿安然 提交于 2019-11-26 06:42:45
问题 Are there any preprocessor symbols which allow something like #if CLR_AT_LEAST_3.5 // use ReaderWriterLockSlim #else // use ReaderWriterLock #endif or some other way to do this? 回答1: I don't think there are any predefined 'preprocessor' symbols. However you can achieve what you want like this: Create different configurations of your project, one for every version of CLR you want to support. Choose a symbol like VERSION2 , VERSION3 etc. per CLR version. In every configuration, define the one

C++ compiling on Windows and Linux: ifdef switch [duplicate]

假装没事ソ 提交于 2019-11-26 06:13:50
问题 This question already has an answer here: How do I check OS with a preprocessor directive? 16 answers I want to run some c++ code on Linux and Windows. There are some pieces of code that I want to include only for one operating system and not the other. Is there a standard #ifdef that once can use? Something like: #ifdef LINUX_KEY_WORD ... // linux code goes here. #elif WINDOWS_KEY_WORD ... // windows code goes here. #else #error \"OS not supported!\" #endif The question is indeed a duplicate

Java conditional compilation: how to prevent code chunks from being compiled?

99封情书 提交于 2019-11-26 03:58:34
问题 My project requires Java 1.6 for compilation and running. Now I have a requirement to make it working with Java 1.5 (from the marketing side). I want to replace method body (return type and arguments remain the same) to make it compiling with Java 1.5 without errors. Details: I have an utility class called OS which encapsulates all OS-specific things. It has a method public static void openFile(java.io.File file) throws java.io.IOException { // open the file using java.awt.Desktop ... } to

Determining 32 vs 64 bit in C++

▼魔方 西西 提交于 2019-11-26 02:17:03
问题 I\'m looking for a way to reliably determine whether C++ code is being compiled in 32 vs 64 bit. We\'ve come up with what we think is a reasonable solution using macros, but was curious to know if people could think of cases where this might fail or if there is a better way to do this. Please note we are trying to do this in a cross-platform, multiple compiler environment. #if ((ULONG_MAX) == (UINT_MAX)) # define IS32BIT #else # define IS64BIT #endif #ifdef IS64BIT DoMy64BitOperation() #else

#ifdef #ifndef in Java

半腔热情 提交于 2019-11-26 01:07:15
问题 I doubt if there is a way to make compile-time conditions in Java like #ifdef #ifndef in C++. My problem is that have an algorithm written in Java, and I have different running time improves to that algorithm. So I want to measure how much time I save when each improve is used. Right now I have a set of boolean variables that are used to decide during the running time which improve should be used and which not. But even testing those variables influences the total running time. So I want to

#ifdef #ifndef in Java

北城以北 提交于 2019-11-26 01:05:14
I doubt if there is a way to make compile-time conditions in Java like #ifdef #ifndef in C++. My problem is that have an algorithm written in Java, and I have different running time improves to that algorithm. So I want to measure how much time I save when each improve is used. Right now I have a set of boolean variables that are used to decide during the running time which improve should be used and which not. But even testing those variables influences the total running time. So I want to find out a way to decide during the compilation time which parts of the program should be compiled and