/******************************************************************************/ /* */ /* FILE: january.cpp */ /* */ /* This program will probably increase the number of visitors of my site ;-) */ /* ========================================================================= */ /* */ /* Compiled and tested with Visual C++ V6.0 */ /* */ /* This program is probably not portable because the string returned */ /* by the name() method is not specified by the standard */ /* */ /* V1.00 28-JAN-2003 P. Tellenbach http://www.heimetli.ch/ */ /* */ /******************************************************************************/ #include <iostream> #include <typeinfo> #include <string> using namespace std ; #define LESS -1 #define SEX 6 #define NO 0 #define MORE * class world { public: virtual ~world() {} } ; class Hello : public world { } ; int main() { cout << typeid(Hello).name() + SEX << typeid(world).name() + SEX LESS << " !" << endl ; return NO MORE SEX ; }
Update 28. January 2023
As expected: the program compiled, but the output was not what I wanted. The program was modified to produce the same output as the previous version.
/******************************************************************************/ /* */ /* FILE: january.cpp */ /* */ /* This program will probably increase the number of visitors of my site ;-) */ /* ========================================================================= */ /* */ /* Compiled and tested with Visual C++ V6.0 */ /* */ /* This program is probably not portable because the string returned */ /* by the name() method is not specified by the standard */ /* */ /* V1.00 28-JAN-2003 P. Tellenbach https://www.heimetli.ch */ /* */ /* Compiled and tested with g++ 11.2.0 */ /* */ /* V1.10 28-JAN-2023 P. Tellenbach https://www.heimetli.ch */ /* */ /******************************************************************************/ #include <iostream> #include <typeinfo> #include <string> using namespace std ; #define MAGIC 1 << " " #define SEX 6 #define NO 0 #define MORE * class world { public: virtual ~world() {} } ; class Hello : public world { } ; int main() { cout << typeid(Hello).name() + MAGIC << typeid(world).name() + MAGIC << "!" << endl ; return NO MORE SEX ; }