2 ms·
Use GObject (https://developer.gnome.org/gobject/stable/ https://developer.gnome.org/gobject/stable/) and GLib. GObject is basically a bunch of macros to let yo
by roel_v 13y ago
Use GObject (https://developer.gnome.org/gobject/stable/ https://developer.gnome.org/gobject/stable/) and GLib. GObject is basically a bunch of macros to let you write OO code in C, GLib is a cross-platform set of libraries with somewhat of a 'standard library' of data structures, string handling stuff etc. It's the foundation of Gnome, it's also LGPL so that may be an issue. To be honest though I've never used it for strictly C-only code, I've only used it on Linux with gcc and it was 10 years ago.
Still, it's a nice hack for when you want to write C++-like code while still using C constructs only.
- skrebbel 13y agoThanks for the suggestion, I'll look into it. That said, my first underbelly reaction is that I don't want to write C++-like code in C. Why would I do that? I might as well use C++ then. It's like writing functional code in Java. It's possible, but it's a hack. What I'd like to learn is how to decently deal with memory, exceptional behaviour, common data structures, etc in modern idiomatic C. Some other people in this thread made some nice suggestions for that, btw, so thanks guys :)
- frou_dh 13y agoMay a thousand home-made hash tables bloom!