Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

cpp2c

Hand-written translation of C++ object-model features into C.

Based on a PublicTransport class hierarchy: constructors / destructors, copy/assignment, inheritance-by-embedding, vtables, virtual dispatch, polymorphic containers, and template-as-macro (MAX_FUNC).

Layout

cpp2c/
├── src/cpp2c.c
├── Makefile
└── README.md

Build & Run

make
make run

C++ → C mapping (highlights)

C++ C in this demo
class / private data struct + nested private struct
constructor / destructor XxxCtor / XxxDtor
virtual function function pointer in vtable
inheritance embedded base struct
new / delete malloc + ctor / dtor + free
template preprocessor macro (MAX_FUNC)

About

Hand-written C translation of C++ vtables, inheritance, and object lifetime.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages