Object-oriented Programming with ANSI-C [pdf]

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • libGimbal

    C17-based extended standard library, cross-language type system, and unit testing framework targeting Sega Dreamcast, Sony PSP and PSVita, Windows, Mac, Linux, Android, iOS, and WebAssembly.

  • This book is an absolute classic. I came from C++20, using concepts and constraints, doing a lot of compile-time metaprogramming and shenanigans, and I set off on a quest to rewrite a lot of my core tech stack in plain ol' C ('17 revision) for language interoperability reasons...

    ...and I literally almost gave up on being a C programmer because of bashing my head against language limitations... This book completely and totally changed everything and is the reason I completed this very ambitious project (https://github.com/gyrovorbis/libgimbal)... It's not just good for object-oriented C, but also for approaching the C language differently in general. For pushing its boundaries rather than accepting its limitations.

  • Cello

    Higher level programming in C

  • Yes, that's C. C macros can take you quite far. Unfortunately because it's just a bunch of macros, it's quite brittle. Like high level abstractions created with macros in assembly language. You have to do all the checking and reasoning about it since the compiler cannot.

    [1] https://libcello.org/

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • COS

    C Object System: a framework that brings C to the level of other high level programming languages and beyond

  • Cloak

    A mini-preprocessor library to demostrate the recursive capabilites of the preprocessor (by pfultz2)

  • Where cloak.h is https://github.com/pfultz2/Cloak/blob/master/cloak.h

    The above macros are admitttedly very hairy. If C had a better preprocessor, but was otherwise unchanged, they could look a lot nicer.

    > I never said such a thing. Would appreciate if you didn't put words in my mouth.

    A normal part of dialogue is, "I'm going to repeat your point back to you in my own words, and you can either agree with my restating of it, or point out at which point I've misunderstood you". That's what I was doing. "Would appreciate if you didn't put words in my mouth" is unnecessary hostility.

    > In my concrete example, given that FILE and DIR were classified as objects, to which of the so-called objects does F(const char*, FILE, DIR) belong?

    Take any language which you agree is "OO". Add one new feature (if it isn't already there): functions/methods which don't belong to any class/object. Now the function you are talking about is possible in that language. Did the language thereby suddenly cease to be OO when we added that feature? Most people would disagree with "Yes". But if "No", what is the actual difference between C and that language?

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts