On a cross-platform project, I want to #include a header file whose name contains the name of the platform. I have a #define macro for the platform.
So for example, for
#define PLATFORM win32
I want
#include "engine\win32\devices_win32.h"
while for
#define PLATFORM linux
I want
#include "engine\linux\devices_linux.h"
I'm g...
Hi,
does anybody know a library similar to boost::preprocessor (maybe not so advanced) that could be easily used/incorporated in plain C projects?
Of course, the most (all ?) of boost::preprocessor is usable when writing in C but I would prefer a small library with only basic capabilities that doesn't depend on the monster like boost.
...
what I'd like to do (for logging purposes) is something like this:
this code has been written to show my problem, actual code is complex and yes, I have good reasons to use macros even on C++ =)
# define LIB_SOME 1
# define LIB_OTHER 2
# define WHERE "at file #a, line #l, function #f: "
// (look for syntax hightlighting error at SO x...
Why tuple documentation for example says to use:
#include "boost/tuple/tuple.hpp"
and not
#include <boost/tuple/tuple.hpp>
I know that it's almost not probably my code will have also boost/tuple/tuple.hpp,
but using include <> states explicitly not to look in the curent directory.
So what is the reason?
...
Can anyone tell me how to insert a function call (say Yield() ) at random places inside a C function , so that each time the code is run , Yield() gets called from different parts of the code ?
I am faced with such a requirement as I'm using 2 threads in a cooperative threading environment , where unless the running thread yields the pr...
Hi guys I'm using the SKELETON_JAR variable on my c++ code in one header. However I want to allow the user to define the place of the jar in the compile time easily. I think the easiest way to do that is to put this define in makefile is that so?
#define SKELETON_JAR "./Util.jar"
??
...
Is there a macro preprocessor for Delphi 7?
There isn't one built in so maybe there's a possibilty to use a third party or some other languages preprocessor (like c preprocessor).
If there's one, how to set it up for Delphi 7?
I'm trying to do function inlining (for speed). Macro preprocessor seems to be the only easy option for delph...
We have a library that provides access to buttons on a device. These buttons are enumerated to the rest of the system as things like "power button" and so on. This way, the rest of the applications don't have to worry about how the "power button" is implemented.
We build this library using a few configuration directives that look like...
Hi,
if anyone has used WT successfully with MSVC (mine is 2005), could you please provide some details on how this can be done?
I have installed WT fine , then ran some examples. The problems begin when I try to create a project of my own, as simple as hello.C. I get a thousand compiler errors like this one :
C:\Program Files\Microsoft...
I'm writing a library that needs to have some code if a particular library is included. Since this code is scattered all around the project, it would be nice if users didn't have to comment/uncomment everything themselves.
In C, this would be easy enough with a #define in a header, and then code blocks surrounded with #ifdefs. Of cours...
I have the following code
#define myfunc(a,b) myfunc(do_a(a), do_b(b))
void myfunc(int a, int b)
{
do_blah(a,b);
}
int main()
{
int x = 6, y = 7;
myfunc(x,y);
return 0;
}
I want the pre-processor to expand function myfunc only at calling. Required code after pre-processing looks like this:
void myfunc(int a, int b)
{...
I'm trying to determine if C++0x features are available when compiling. Is there a common preprocessor macro? I'm using Visual Studio 2010's compiler and Intel's compiler.
...
How do I at compiletime undefine a compiler macro using gcc. I tried some compile args to gcc like -D but I cant get to see the "not defined" message.
Thanks
#include <iostream>
#define MYDEF
int main(){
#ifdef MYDEF
std::cout<<"defined\n";
#else
std::cout<<"not defined\n";
#endif
}
...
I'm abusing the C preprocessor for my build system to produce a "readme" plain-text file and a web page from the same source file. The construction is something like this:
The actual definitions are in data.h:
#define WEBSITE "http://example.com"
Note that the // in the URL must be quoted, or else it will be treated as the start of a...
I have created a macro to make reserve memory for my strings in C. It looks like this:
#define newString(size) (char*)malloc(sizeof(char) + size)
So is there any reason I shouldn't use this macro in my own personal projects? I know I shouldn't do this in production code because it would require everyone to have that header file and ev...
/*
#define FOO
*/
#ifdef FOO
#define BAR "pirate"
#else
#define BAR "ninja"
#endif
int main() { printf(BAR); getchar(); }
In this code FOO is not defined (Visual Studio 2008). I assume that comments are processed first, then preprocessor, and then code. Are comments always processed before the preprocessor? Is this part of a standar...
My C project uses preprocessor directives to activate / deactive some features. It's not unusual to find some of the less common configurations do not compile anymore due to a change made a few days ago within an #ifdef.
We use a script to compile the most common configurations, but I'm looking for a tool to ensure everything is compile...
I've been through quite a number of articles on stack overflow that answered the question "How do I pass preprocessor definitions to the compiler from the MSBuild command line," and they all responded with some variation of:
MSBuild.exe /p:DefineConstants=THING_TO_BE_DEFINED
I have tried every variation that I could come up with:
MSB...
Hi
I have found a set of great macros here Objective C Macros
I put the:
#if DEBUG==1
#define .... macros
in my header file.
Now I simply can't figure out where to set DEBUG=1 or DEBUG=0 in Xcode so that
it will define the macro when debugging and not when releasing.
Hope someone can help me find the missing drop down menu:)
Thank...
i have a c program below:
#define f(g,g2) g##g2
main()
{
int var12=100;
printf("%d",f(var,12));
}
when i run just the preprocessor it expands this as
{
int var12=100;
printf("%d",var12);
}
which is the reason why the output is 100.
can anybody tell me how/why the preprocessor expands var##12 to var12?
...