Advertisement
C0BRA

C++ Compiler Name

May 12th, 2013
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.11 KB | None | 0 0
  1. //wget http://pastebin.com/raw.php?i=LsvHAZqC main.cpp; g++ main.cpp -o test; ./test
  2.  
  3. #include <string>
  4.  
  5. using namspace std;
  6.  
  7. string to_string()
  8. {
  9.     return "";
  10. }
  11.  
  12. template<typename T>
  13. string to_string(T x)
  14. {
  15.     stringstream str;
  16.     str << x;
  17.     return str.str();
  18. }
  19.  
  20. string CompilerName()
  21. {
  22.     return "built " __DATE__ " " __TIME__
  23.    
  24.     "; built with: "
  25. #if defined(__clang__)
  26.     "Clang/LLVM " __VERSION__
  27. #elif defined(__ICC) || defined(__INTEL_COMPILER)
  28.     "Intel ICC/ICPC " + to_string(__INTEL_COMPILER_BUILD_DATE) +
  29. #elif defined(__GNUC__) || defined(__GNUG__)
  30.     "GNU GCC/G++ " __VERSION__
  31. #elif defined(__HP_cc) || defined(__HP_aCC)
  32.     "Hewlett-Packard C/C++ " + to_string(__HP_aCC) + to_string(__HP_cc) +
  33. #elif defined(__IBMC__) || defined(__IBMCPP__)
  34.     "IBM XL C/C++ " __xlc__
  35. #elif defined(_MSC_VER)
  36.     "Microsoft Visual Studio " + to_string(_MSC_FULL_VER) +
  37. #elif defined(__PGI)
  38.     "Portland Group PGCC/PGCPP"
  39. #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
  40.     "Oracle Solaris Studio"
  41. #else
  42.     " unknown compiler"
  43. #endif
  44.     ;
  45. }
  46.  
  47. int main(int, char**)
  48. {
  49.     cout << CompilerName() << "\n";
  50.    
  51.     return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement