fork download
  1. #define COMPARE(T) \
  2.   int compare(const T s) \
  3.   { \
  4.   int c = compare(s.GetString()); \
  5.   return c; \
  6.   }
  7.  
  8. COMPARE(CStringA)
  9. COMPARE(CStringW)
  10.  
  11. #undef COMPARE
  12.  
  13.  
  14. #define COMPARE(T) \
  15.   int compare(const T s) \
  16.   { \
  17.   int c = compare(s.c_str()); \
  18.   return c; \
  19.   }
  20.  
  21. COMPARE(std::string)
  22. COMPARE(std::wstring)
  23.  
  24. #undef COMPARE
  25.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:8:9: error: 'CStringA' does not name a type
 COMPARE(CStringA)
         ^
prog.cpp:2:21: note: in definition of macro 'COMPARE'
   int compare(const T s) \
                     ^
prog.cpp: In function 'int compare(int)':
prog.cpp:4:23: error: request for member 'GetString' in 's', which is of non-class type 'const int'
     int c = compare(s.GetString()); \
                       ^
prog.cpp:8:1: note: in expansion of macro 'COMPARE'
 COMPARE(CStringA)
 ^
prog.cpp: At global scope:
prog.cpp:9:9: error: 'CStringW' does not name a type
 COMPARE(CStringW)
         ^
prog.cpp:2:21: note: in definition of macro 'COMPARE'
   int compare(const T s) \
                     ^
prog.cpp: In function 'int compare(int)':
prog.cpp:2:7: error: redefinition of 'int compare(int)'
   int compare(const T s) \
       ^
prog.cpp:9:1: note: in expansion of macro 'COMPARE'
 COMPARE(CStringW)
 ^
prog.cpp:2:7: note: 'int compare(int)' previously defined here
   int compare(const T s) \
       ^
prog.cpp:8:1: note: in expansion of macro 'COMPARE'
 COMPARE(CStringA)
 ^
prog.cpp:4:23: error: request for member 'GetString' in 's', which is of non-class type 'const int'
     int c = compare(s.GetString()); \
                       ^
prog.cpp:9:1: note: in expansion of macro 'COMPARE'
 COMPARE(CStringW)
 ^
prog.cpp: At global scope:
prog.cpp:21:14: error: 'string' in namespace 'std' does not name a type
 COMPARE(std::string)
              ^
prog.cpp:15:21: note: in definition of macro 'COMPARE'
   int compare(const T s) \
                     ^
prog.cpp: In function 'int compare(int)':
prog.cpp:15:7: error: redefinition of 'int compare(int)'
   int compare(const T s) \
       ^
prog.cpp:21:1: note: in expansion of macro 'COMPARE'
 COMPARE(std::string)
 ^
prog.cpp:2:7: note: 'int compare(int)' previously defined here
   int compare(const T s) \
       ^
prog.cpp:8:1: note: in expansion of macro 'COMPARE'
 COMPARE(CStringA)
 ^
prog.cpp:17:23: error: request for member 'c_str' in 's', which is of non-class type 'const int'
     int c = compare(s.c_str()); \
                       ^
prog.cpp:21:1: note: in expansion of macro 'COMPARE'
 COMPARE(std::string)
 ^
prog.cpp: At global scope:
prog.cpp:22:14: error: 'wstring' in namespace 'std' does not name a type
 COMPARE(std::wstring)
              ^
prog.cpp:15:21: note: in definition of macro 'COMPARE'
   int compare(const T s) \
                     ^
prog.cpp: In function 'int compare(int)':
prog.cpp:15:7: error: redefinition of 'int compare(int)'
   int compare(const T s) \
       ^
prog.cpp:22:1: note: in expansion of macro 'COMPARE'
 COMPARE(std::wstring)
 ^
prog.cpp:2:7: note: 'int compare(int)' previously defined here
   int compare(const T s) \
       ^
prog.cpp:8:1: note: in expansion of macro 'COMPARE'
 COMPARE(CStringA)
 ^
prog.cpp:17:23: error: request for member 'c_str' in 's', which is of non-class type 'const int'
     int c = compare(s.c_str()); \
                       ^
prog.cpp:22:1: note: in expansion of macro 'COMPARE'
 COMPARE(std::wstring)
 ^
stdout
Standard output is empty