Piece
[C/C++] Predefined Macros
More Code
2018. 6. 30. 09:19
#include <iostream>
using namespace std;
int main()
{
// Standard Predefined Macros
cout << "File: " << __FILE__ << endl;
cout << "Line: " << __LINE__ << endl;
cout << "Func: " << __func__ << endl;
cout << "Date: " << __DATE__ << endl;
cout << "Time: " << __TIME__ << endl;
// MSC Specific Predefined Macros
int majorNumber = (_MSC_VER) / 100;
int minorNumber = (_MSC_VER) % 100;
int buildNumber = (_MSC_FULL_VER) % 100000;
printf("MSC Version: %d.%d.%d\n", majorNumber, minorNumber, buildNumber);
// GCC Specific Predefined Macros
printf("GCC Version: %d.%d.%d\n", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
return 0;
}