preprocessor

iOS - detect if app is running from Xcode [duplicate]

两盒软妹~` 提交于 2019-12-03 11:33:43
This question already has answers here : Detecting if iOS app is run in debugger (8 answers) I'm trying to enable/disable parts of my code based on whether or not the code be being run via USB/Xcode (debug), or in production mode downloaded from the app store (release). I'm aware of checking if it is running in DEBUG or RELEASE mode like this: #ifdef DEBUG // Stuff for debug mode #else // Stuff for release mode #endif but the problem is that an obvious loop-hole I see is you can change the Build Configuration for the 'Run' build scheme from 'Debug' to 'Release'. A better way would be if I can

What is the preprocessor macro to test whether an application extension is being built?

冷暖自知 提交于 2019-12-03 08:53:53
问题 This question is based purely on publicly released documents regarding the introduction of application extensions in iOS. With the introduction of app extensions in iOS 8, it is now possible to "extend custom functionality and content beyond your app and make it available to users while they’re using other apps". In my implementation of my extension, I am including some classes from my actual app in my extension (models, etc). The problem is that these classes make calls to UIApplication ,

Tool/Parser for preprocessor #if statements?

此生再无相见时 提交于 2019-12-03 08:22:57
I am working on many C-sourcecode files which contain many preprocessor #if , #elseif and #else statements. This statements often check for a #define , e.g. #if(Switch_TestMode == Switch_TestModeON) /* code 1 */ #else /*code 2 */ #endif Often this preprocessor statements are located within c-if statements which makes the sourcecode nearly unreadable for human beeings. The #define s used for this preprocessor #if statements are defined within an extra file. My idea now is to have a tool which checks this #define d switch settings and then only copies the lines of sourcecode which apply using

WiX undefined preprocessor variable

女生的网名这么多〃 提交于 2019-12-03 08:06:28
问题 I'm starting to use WiX in order to do automated builds to create msi's of my c# projects and am experiencing the error "Undefined preprocessor variable '$(var.MyProject.TargetDir)'" I am using the latest WiX v3.0.5419. Inside my wxs file I am trying to use pre-processor variables that are listed on this webpage (http://blogs.msdn.com/jrock/archive/2008/01/29/complete-list-of-candle-preprocessor-variables.aspx) <Component Id="MyId" Guid="MyGuid"> <File Id="MyId" Name="MyName" KeyPath="yes"

Visual Studio: how to check used C++ platform toolset programmatically

旧街凉风 提交于 2019-12-03 05:37:44
I have to build project using MSVC2012 and v100 platform toolset (from MSVC2010). Unfortunately I'm using C++11 feature " range based for " across the code. I wondering if there is a preprocessor directive that allows to know current platform toolset in compile time. I.e #if (_MSC_PLATFORM_TOOLSET > 100) # define ALLOW_RANGE_BASED_FOR 1 #else # define ALLOW_RANGE_BASED_FOR 0 #endif I tried use _MSC_VER macro, but for both platform toolsets it is set to 1700 (and this does make sense, because I'm still using MSVC2012). I'd appreciate any suggestion. Thank you. The macro _MSC_FULL_VER is

“Debug only” code that should run only when “turned on”

怎甘沉沦 提交于 2019-12-03 02:49:54
问题 I would like to add some C# "debug only" code that only runs if the person debugging requests it. In C++, I used to do something similar to the following: void foo() { // ... #ifdef DEBUG static bool s_bDoDebugOnlyCode = false; if (s_bDoDebugOnlyCode) { // Debug only code here gets executed when the person debugging // manually sets the bool above to true. It then stays for the rest // of the session until they set it to false. } #endif // ... } I can't do exactly the same in C# since there

CMake conditional preprocessor define on code

∥☆過路亽.° 提交于 2019-12-03 02:02:10
问题 I'm migrating a makefile project to CMake. The person who wrote the makefile the first time had done a module for writing certain values in an include file. There's a main config.h file that includes a config_in.h. The config.h file contains something like this: #ifndef USE_FEATURE_A #define USE_FEATURE_A 0 #endif #ifndef USE_FEATURE_B #define USE_FEATURE_B 0 #endif In the makefile there's a fake target like with_feature_a that writes in config_in.h #define USE_FEATURE_A 1 In this way someone

Improving performance of preprocessing large set of documents

喜夏-厌秋 提交于 2019-12-02 22:33:20
问题 I am working on a project related to plagiarism detection framework using Java. My document set contains about 100 documents and I have to preprocess them and store in a suitable data structure. I have a big question that how am i going to process the large set of documents efficiently and avoiding bottlenecks . The main focus on my question is how to improve the preprocessing performance. Thanks Regards Nuwan 回答1: You're a bit lacking on specifics there. Appropriate optimizations are going

WiX undefined preprocessor variable

孤人 提交于 2019-12-02 21:39:15
I'm starting to use WiX in order to do automated builds to create msi's of my c# projects and am experiencing the error "Undefined preprocessor variable '$(var.MyProject.TargetDir)'" I am using the latest WiX v3.0.5419. Inside my wxs file I am trying to use pre-processor variables that are listed on this webpage ( http://blogs.msdn.com/jrock/archive/2008/01/29/complete-list-of-candle-preprocessor-variables.aspx ) <Component Id="MyId" Guid="MyGuid"> <File Id="MyId" Name="MyName" KeyPath="yes" Source="$(var.MyProject.TargetDir)\MyName.dll" /> </Component> I have added the reference for MyProject

Externally Define Preprocessor Macros in GLSL

≡放荡痞女 提交于 2019-12-02 19:04:35
GLSL has a full C-style preprocessor. The only thing that does not work is #include. One of the great features is that that you can used #ifdef to comment out functions and thus create one shader that can be thinned out if certain features are not used. My Question is: Is there a way to define a macro from C code? There seems no way to do that with the openGL interface. The quick hack is to prepend a few lines with #define FOO before the code loaded form file. But it seems kind of backwards. You don't really need to prepend it to the code you loaded. That's why there are multiple strings in