X
xuatla
I tried the following code and complied in g++
#include <iostream>
using namespace std;
int main()
{
#ifdef __cplusplus
cout << "c++ program" << endl;
#endif
#ifdef __STDC__
cout << "c program" << endl;
#endif
return 0;
}
the output is
c++ program
c program
So both __cplusplus & __STDC__ are defined. But from C++ Primer I read
that only one of them will be defined in a program. What's wrong with my
code/result?
Thanks.
X
#include <iostream>
using namespace std;
int main()
{
#ifdef __cplusplus
cout << "c++ program" << endl;
#endif
#ifdef __STDC__
cout << "c program" << endl;
#endif
return 0;
}
the output is
c++ program
c program
So both __cplusplus & __STDC__ are defined. But from C++ Primer I read
that only one of them will be defined in a program. What's wrong with my
code/result?
Thanks.
X