preprocessor

Managing highly repetitive code and documentation in Java

橙三吉。 提交于 2019-11-27 06:28:48
Highly repetitive code is generally a bad thing, and there are design patterns that can help minimize this. However, sometimes it's simply inevitable due to the constraints of the language itself. Take the following example from java.util.Arrays : /** * Assigns the specified long value to each element of the specified * range of the specified array of longs. The range to be filled * extends from index <tt>fromIndex</tt>, inclusive, to index * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the * range to be filled is empty.) * * @param a the array to be filled * @param fromIndex

Using preprocessor directives in BlackBerry JDE plugin for eclipse?

不问归期 提交于 2019-11-27 05:13:21
How to use preprocessor directives in BlackBerry JDE plugin for eclipse? Fostah Within the eclipse config file (%ECLIPSE_HOME%\configuration\config.ini) make sure the following line exists. osgi.framework.extensions=net.rim.eide.preprocessing.hook With the current BlackBerry plugin (1.0.0.67) config line is added for you. I'm not sure about older versions of the plugin. Also, checkout this Stack Overflow question for more information on the BlackBerry preprocessor. Preprocessor directives supported by the RIM compiler 来源: https://stackoverflow.com/questions/1383277/using-preprocessor

Inno Setup: How do I see the output (translation) of the Inno Setup Preprocessor?

寵の児 提交于 2019-11-27 05:09:23
I have an Inno Setup script with preprocessor directives ( #define s, #if s, etc.) I want to run the Inno Setup preprocessor on my script and see the preprocessor's output (translation in Inno-Setup-speak). That is, I want to look at the result of the preprocessor which it normally feeds into the Inno Setup Compiler, where all the references to {#something} are changed into whatever something was defined as. I look at the command line options (of iscc.exe ) and #pragma directives and did not find what I'm looking for. I see that I can specify not to run the compiler ( #pragma -c- | /$c- ) but

CUDA and nvcc: using the preprocessor to choose between float or double

情到浓时终转凉″ 提交于 2019-11-27 04:18:30
The problem : Having a .h, I want to define real to be double if compiling for c/c++ or for cuda with computing capability >= 1.3. If compiling for cuda with computing capability < 1.3 then define real to be float. After many hours I came to this (which does not work ) # if defined(__CUDACC__) # warning * making definitions for cuda # if defined(__CUDA_ARCH__) # warning __CUDA_ARCH__ is defined # else # warning __CUDA_ARCH__ is NOT defined # endif # if (__CUDA_ARCH__ >= 130) # define real double # warning using double in cuda # elif (__CUDA_ARCH__ >= 0) # define real float # warning using

How do I use theme preprocessor functions for my own templates?

亡梦爱人 提交于 2019-11-27 04:16:18
问题 I have several .tpl.php files for nodes, CCK fields, and Views theming. These template files have a lot of logic in them to move things around, strip links, create new links, etc. I understand that this is bad development and not "The Drupal Way". If I understand correctly, "The Drupal Way" is to use preprocessor functions in your template.php file to manipulate variables and add new variables. A few questions about that: Is there a naming convention for creating a preprocessor function for a

Can I add numbers with the C/C++ preprocessor?

回眸只為那壹抹淺笑 提交于 2019-11-27 03:54:13
问题 For some base. Base 1 even. Some sort of complex substitution -ing. Also, and of course, doing this is not a good idea in real life production code. I just asked out of curiosity. 回答1: You can relatively easy write macro which adds two integers in binary . For example - macro which sums two 4-bit integers in binary : #include "stdio.h" // XOR truth table #define XOR_0_0 0 #define XOR_0_1 1 #define XOR_1_0 1 #define XOR_1_1 0 // OR truth table #define OR_0_0 0 #define OR_0_1 1 #define OR_1_0 1

How do you implement “#ifdef” in python?

丶灬走出姿态 提交于 2019-11-27 01:15:14
问题 Programming in C I used to have code sections only used for debugging purposes (logging commands and the like). Those statements could be completely disabled for production by using #ifdef pre-processor directives, like this: #ifdef MACRO controlled text #endif /* MACRO */ What is the best way to do something similar in python ? 回答1: If you just want to disable logging methods, use the logging module. If the log level is set to exclude, say, debug statements, then logging.debug will be very

What are the gcc predefined macros for the compiler's version number?

只谈情不闲聊 提交于 2019-11-27 01:04:39
问题 I have run into a bug with gcc v3.4.4 and which to put an #ifdef in my code to work around the bug for only that version of the compiler. What are the GCC compiler preprocessor predefined macros to detect the version number of the compiler? 回答1: From the gnu cpp manual... __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__ These macros are defined by all GNU compilers that use the C preprocessor: C, C++, Objective-C and Fortran. Their values are the major version, minor version, and patch level of

How do I define preprocessor macros in Xcode 4?

烈酒焚心 提交于 2019-11-26 19:51:41
问题 I have two targets set up for my app (a lite version and a pro version) and I want to integrate some subtle differences in the code for each of them (e.g. the pro version will not show any iAd banners). I have been looking around and I see the easiest way to do this is through the use of preprocessor macros. The issue I'm facing is how to set them up in Xcode 4. I want to set up a macro called 'PRO_VERSION' in one target & 'LITE_VERSION' in the other. Below is an example of how I intend to

Xcode 4 can't locate public header files from static library dependency

风流意气都作罢 提交于 2019-11-26 16:51:38
Alternate titles to aid search Xcode can't find header Missing .h in Xcode Xcode .h file not found lexical or preprocessor issue file not found I'm working on an iOS application project which came from Xcode 3. I have now moved to Xcode 4 my project builds a number of static libraries. Those static libraries also declare public headers and those headers are used by the application code. In Xcode 3.x the headers were copied (as a build phase) to the public headers directory , then in the application project the public headers directory was added to the headers search list . Under Xcode 4 the