Using xpp as cpp(c++) is very easy and fun, as long as your hands are enough.
hello.xpp
#include <iostream> class Hello { public: Hello() {std::cout << "Hello!" << std::endl;} ~Hello() {std::cout << "Bye!" << std::endl;} }; int main() { delete (new Hello); }
swan.xpp
#include <iostream> class Swan { public: Swan() { std::cout << "Hello, I am a swan!" << std::endl; } }; int main() { Swan swan; }
C:\tmp>cl /TP swan.xpp C:\tmp>swan.exe Hello, I am a swan!
$ gcc -xc++ swan.xpp -lstdc++ -o swan $ ./swan Hello, I am a swan!
$ g++ -xc++ swan.xpp -o swan $ ./swan Hello, I am a swan!
$ clang -xc++ swan.xpp -lc++ -o swan $ ./swan Hello, I am a swan!
$ clang++ -xc++ swan.xpp -o swan $ ./swan Hello, I am a swan!
Last revised: March 04, 2022 at 05:37:35 GMT |