The only pre-process directive that I know about in VBScript / Classic ASP is the #include. I don't know if that is the official name but I'm basically looking for code that can execute code or other instructions before the general VBScript.
Are there any other such directives in VBScript? Such as #If or something?
I'd like to be abl...
Hi,
Is there a single preprocessor token that can be used to detect any iPhone device or simulator at build time? I'm currently using:
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
// This is an iPhone build
#endif
Is this the recommended approach or is there a better way? I'd prefer the macro to be built-in, i.e. defined by the compil...
I'm trying to build Amaya. When the build failed with
error: expected unqualified-id before ‘(’ token
I ran g++ with only the preprocessor (replacing the -c option with -E) on the file that failed to compile to see what was going on. This produced an 80,000 line file, showing me that 'Blue' had been replaced by (2 << 8), which clear...
I need to exclude some code from the compilation when targeting the .NET 3.5 framework, but not when targeting 2.0. Is this possible using preprocessor conditions (#if/#endif)? Or maybe some other method.
Oops, duplicate.. closing...
...
The Wikipedia entry for the C Preprocessor states:
The language of preprocessor
directives is agnostic to the grammar
of C, so the C preprocessor can also
be used independently to process other
types of files.
How can this be done? Any examples or techniques?
EDIT: Yes, I'm mostly interested in macro processing. Even thoug...
HI,
Consider the following code:
void Foo() {
......
LOG_ERROR("I'm error 1") // call 1
.....
LOG_ERROR("I'm error 2") // call 2
.....
}
LOG_ERROR() is a macro. LOG_ERROR() should print string identifying it
in code, while the assumption is that code can change, but A::Foo()
will remain unchanged. The identifier should ...
Hey all,
I'm writing a small library in C++ that I need to be able to build on quite a few different platforms, including iPhone, Windows, Linux, Mac and Symbian S60. I've written most of the code so that it is platform-agnostic but there are some portions that must be written on a per-platform basis.
Currently I accomplish this by...
If you have a header file named ThisIsAHeaderFile.h, the following will still locate the file in Visual Studio:
#include <ThisIsAheaderFile.h>
Is there a way to enforce case sensitivity so that the #include will result in an error?
...
I have a class with two possible implementations, depending on a preprocessor switch. The way I have handled this is to create "src\CompSwitch1\class.h" and "src\CompSwitch2\class.h". In my standard include file, I use
#ifdef CompSwitch1
#include "CompSwitch1\class.h"
#elif CompSwitch2
#include "CompSwitch2\clas...
I'm writing a bunch of related preprocessor macros, one of which generates labels which the other one jumps to. I use them in this fashion:
MAKE_FUNNY_JUMPING_LOOP(
MAKE_LABEL();
MAKE_LABEL();
)
I need some way to generate unique labels, one for each inner MAKE_LABEL call, with the preprocessor. I've tried using __LINE__, but sinc...
OK, without going into the gory details I want to use a #define macro that will expand to a #include but the '#' sign is confusing the preprocessor (as it thinks I want to quote an argument.)
For example, I want to do something like this:
#define MACRO(name) #include "name##foo"
And use it thus:
MACRO(Test)
Which will expand to:
...
Hello All,
Back a long time ago I used to use pre-compiled headers: a. to speed compilation and b. because I supported multiple development tools like CodeWarrior, MPW, VS, ProjectBuilder, gcc, intel compilers, etc, etc.
Now I have a Mac Pro with 32gb of RAM.
Now I use just CMake.
So do we really need pre-compiled headers anymore?
...
Is there a compiler or standalone preprocessor which takes C++ files and runs a template expansion pass, generating new C++ code with expanded template instantiations?
I remember such a tool in the mid-90s when templates were still new and experimental, and the preprocessor was a way to do template programming with compilers without nat...
Hello,
I have a C program with a lot of optimizations that can be enabled or disabled with #defines. When I run my program, I would like to know what macros has been defined at compile time.
So I am trying to write a macro function to print the actual value of a macro. Something like this :
SHOW_DEFINE(X){\
if( IS_DEFINED(X) )\
...
I'm trying to change the behaviour of some functions in C with help of the preprocessor; and also add optional parameters that can be set on or off...
The basic pattern for the optional parameters is easy:
#ifdef OPT_PARAM
#define my_func(a, b, opt) _my_func(a, b, opt)
#else
#define my_func(a, b, opt) _my_func(a, b)
#endif
/*the r...
I'm trying to write some portable C++ library code that will initially rely on Boost.Regex, and then move to TR1 as compilers support it, and eventually to the C++0x specification after things get moved from the std::tr1 namespace to std. Here is some pseudo-code for what I'd like to do with the preprocessor:
if( exists(regex) ) // c...
In gcc, wow can I check what C preprocessor definitions are in place during the compilation of a C program, in particular what standard or platform-specific macrodefinitions are defined?
...
I've been hacking on a program that itself creates simulation programs in C. The user specifies the top-level design, and this programs inserts small C-fragments and a helluvalot glue-code (a few thousand lines).
It does local naming by #defines:
#define x local_x
#define vx local_vx
/* user code that uses x, ex */
vx = x / 2
#undef vx...
Hello. Is is possible to print to stderr the value of a preprocessor variable in C? For example, what I have right now is:
#define PP_VAR (10)
#if (PP_VAR > 10)
#warning PP_VAR is greater than 10
#endif
But what I'd like to do is:
#define PP_VAR (10)
#if (PP_VAR > 10)
#warning PP_VAR=%PP_VAR%
#endif
Is something like this...
Hello,
I'm having a macro like this ( not exactly, but function is quite equivalent):
#define STRUCTMEMBER(Member,Value) GlobalStructInstance. ## Member = Value
...
STRUCTMEMBER(Item,1);
This works perfectly in Visual C++, but gcc 3.4.5 (MingGW) yield the following error:
pasting "." and "Item" does not give a valid preprocessing to...