Questions tagged [predefined-macro]
38 questions
3
votes
1 answer
Check if compiler is Turbo C++
I am currently dealing with legacy code designed for Turbo C++. To work around Turbo C++'s lack of a bool data type, the program contains the following line of code.
// Necessary when compiling with Turbo C++
enum bool {false, true};
Most C++…

Stevoisiak
- 23,794
- 27
- 122
- 225
3
votes
2 answers
Is there any predefined macro like _MSC_BUILD(supported from vs2008) in visual studio 2005?
I hope for using any predefined macro like _MSC_BUILD (from vs2008) because I want to use revision number of compiler.
but i can't find that in vs2005.
thank you for your help.

whiteapplecompany
- 31
- 2
3
votes
3 answers
Are there specific defines of linuxthreads and nptl
I hav a programme, which must work differently for linuxthreads and nptl.
Are there defines in this libs, that can be used in my programme to detect, is nptl is used or is linuxthreads is?
UPDATE1: For runtime there is a getconf GLIBC_LIBPTHREADS,…

osgx
- 90,338
- 53
- 357
- 513
3
votes
0 answers
GCC predefined macros for architecture X
I have googled for a list of predefined macros per architecture used by gcc without success. Is there such a list or do I need to -dM for crosscompilers.

user877329
- 6,717
- 8
- 46
- 88
3
votes
1 answer
Which version of the Dinkumware STL Lib ships with Visual Studio 2012?
In earlier versions of Visual Studio, there was a predefinied macro "_CPPLIB_VER" which reported the version of the Dinkumware STL Library shipped with this version of VS. As of 2012, I am unable to find or use this macro - it is undefinied and I am…

ThE_-_BliZZarD
- 722
- 2
- 12
- 26
2
votes
1 answer
Is there a way to export the predefined macros from a Keil build configuration?
Context:
I'm trying to automate some of the more mundane tasks in embedded development with Keil. The end result I'm aiming for is that clicking build in a Keil project will run a pre-build step that runs all the code through Uncrustify (a source…

P Moody
- 33
- 6
2
votes
2 answers
What macro are predefined by gcc for different SPARC processors?
What macroses are predefined for C programms by GCC complier running on different SPARC processors. OS is the Linux.
So how can I distinguish between UltraSPARC, SuperSPARC, Niagara, SPARC64, etc in compile time.
Thanks

osgx
- 90,338
- 53
- 357
- 513
2
votes
1 answer
Is there a visual c++ predefined preprocessor macro that lets you know when the compiler is optimizing
I would like to be able to do something like this using visual c++ compiler (vc12):
// If we have compiled with O2
#ifdef _O2_FLAG_
bool debug_mode = false;
// If we are in dirty slow non optimized land
#else
bool debug_mode = true;
#endif
But I…

sji
- 1,877
- 1
- 13
- 28
2
votes
3 answers
Why would __FUNCTION__ be undefined?
I have a C++ library that uses the predefined macro __FUNCTION__, by way of crtdefs.h. The macro is documented here. Here is my usage:
my.cpp
#include
...
void f()
{
L(__FUNCTIONW__ L" : A diagnostic message");
}
static void L(const…

Justin R.
- 23,435
- 23
- 108
- 157
1
vote
2 answers
How to backup #define macro value in C?
I want to backup macro value like below.
g++ ... -D_XOPEN_SOURCE=600
current _XOPEN_SOURCE value is 600
// xxx.h
#define _XOPEN_SOURCE 700 // redefine
#ifdef _XOPEN_SOURCE // 600
#define _XOPEN_SOURCE_BACK _XOPEN_SOURCE
#undef _XOPEN_SOURCE //…

킵고잉
- 11
- 2
1
vote
1 answer
Actual build date in C++
I need to get build date of a module. I use __DATE__ macro. But it looks like if the file which contains this macro is not changed then it is not compiled and build date is left old and incorrect. How to make sure that build date updates? Maybe…

Andrey Epifantsev
- 976
- 1
- 11
- 27
1
vote
1 answer
macro passed from compile cannot be resolved in eclipse
I am trying to pass a defined macro to my program at compile time like this:
#include
int main() {
// KEY_CNT is not defined in program but passed at compile time
printf("KEY_CNT: %d", KEY_CNT);
return 0;
}
and compile with…

MarZzz
- 329
- 2
- 12
1
vote
1 answer
c++ defining function using #define macro to check com result
So I'm working on a windows application and I've decided to write several helper functions to check the HRESULT returned by any com-related function when it is called. I'm trying to define those functions into a macro #define block but I'm really…

Calvin Hu
- 3,595
- 4
- 18
- 23
1
vote
1 answer
What is __VMKLNX__ in Linux header files?
In a lot of Linux kernel modules (hardware drivers) their source header files, one can spot lines like:
#ifndef __VMKLNX__
__VMKLNX__ is not defined in the source code of this module. A guess is that __VMKLNX__ is a "C" system specific predefined…

Pro Backup
- 729
- 14
- 34
1
vote
1 answer
Is there a predefined macro for Configuration type in Eclipse CDT?
I am using CDT for building a system comprised of many projects. Some of the system elements are dependent on the Configuration type - Debug or Release.
I am aware that there is nothing utterly special in these names, and that I can define my own…

ysap
- 7,723
- 7
- 59
- 122