Am 17.10.13 09:23, schrieb Peter Cacioppi:
Do you have a clean little example of polymorphism being
mocked in a reasonable way with pure C? There are many nice
object-based C projects floating around, but real polymorphism? I
think you can't do it without some bizarre work-arounds, but I'd be
happy to be shown otherwise.
http://stackoverflow.com/questions/524033/how-can-i-simulate-oo-style-polymorphism-in-c/524076#524076
(Haven't tried to compile it, but I think there is an error in answer
#5, the this pointer must be cast to VTable* before calling).
C is reasonably close to OO thanks to its structs. Most language
constructs of C++ can be directly converted into C with just some more
typing effort. You will have problems with exceptions (setjump?),
templates (macros?) and RTTI.
Christian
--
https://mail.python.org/mailman/listinfo/python-list