Find a file
2026-08-09 03:25:57 +05:00
amogus.c reads you 2026-08-09 03:25:57 +05:00
amogus.h amogus 2026-08-09 02:31:21 +05:00
amogus.hh amogus 2026-08-09 02:31:21 +05:00
base.h amogus 2026-08-09 02:31:21 +05:00
build.sh amogus 2026-08-09 02:31:21 +05:00
cxx-types.h amogus 2026-08-09 02:31:21 +05:00
derived.cpp sussy 2026-08-09 01:48:26 +05:00
main.c amogus 2026-08-09 02:31:21 +05:00
main.cpp amogus 2026-08-09 02:31:21 +05:00
README.md reads you 2026-08-09 03:25:57 +05:00

Simple C++ and C demo toying with the inner workings of the Itanium C++ ABI in regards to virtual classes and inheritance of such.

What's here:

  • Base class with one virtual function who (prints a message) and a virtual destructor
  • Derived_Clang subclass of Base, compiled using Clang
  • Derived_GCC subclass of Base, compiled using GCC
  • Derived_Amogus subclass of Base, written in C with an additional non-virtual vent method
  • A heap-allocating "constructor" function for each Derived class
  • Entry point (main.cpp, compiled as bin/main). Calls each "constructor" to obtain the derived classes, then invokes their who functions, casts one of the allocated objects into an Amogus (checking the type at runtime), then makes it vent.
  • Same entry point, but rewritten in C (main.c, compiled as bin/cmain).

The demo shows interoperability between the GCC and Clang C++ compilers, as well as a way to make use of a C++ ABI without writing C++ code.

To run the demo, first install GCC and Clang, then run ./build.sh, after which executable files bin/main and bin/cmain become available.