6 ms·
Smart pointers in C, wow, who would imagine? Although I must say, I'll probably never use this in a project because: - Using C for anything but systems program
by doodlesdev 4y ago
Smart pointers in C, wow, who would imagine? Although I must say, I'll probably never use this in a project because:
- Using C for anything but systems programming is either malevolence or for fun, there's no pratical reason for it. In this case you probably don't want to have external dependencies only to have data structures.
- Having dependencies in C is an absolute pain in the ass unless it's a single header file (such as sqlite). It also makes it much harder to make the codebase portable.
I might try it out though just for gigs and laughs.
Tangentially, I wonder why more C developers don't use self-contained dependencies such as GNULib [0], Klib [1], or APR [2] instead of reimplementing base primitives. It's so common for C projects to reimplement every single thing from scratch. "If you want to make a pie from scratch, you must first invent the universe" kind of thing.
Managing packages is a pain, but reimplementing an efficient battle-tested hash table is even worse IMO. Would be happy to hear it from people who worked (professionally) with C about this.
[0]: https://www.gnu.org/software/gnulib/ https://www.gnu.org/software/gnulib/
[1]: https://github.com/attractivechaos/klib https://github.com/attractivechaos/klib
[2]: https://apr.apache.org/ https://apr.apache.org/
- up2isomorphism 4y agoTake any binary (written in C) and do a ldd binary, and take a look at what language they are written, and you obviously know that they DO use other libraries. The difference is that C people usually has a different view on the data structures, in a sense that under system level programming context most of the data structures will be much more efficient when adapted into the context. That's why you did not see that many "universal" C data structure library because they know it is a hard thing to mess up with if you need efficiency.
- synergy20 4y agothese three are not widely used somehow,glib might be a better choice though.
- doodlesdev 4y agoI thought Glib was mostly used in GNOME applications? Does it see any use elsewhere (i.e. Windows/MacOS)?
- synergy20 4y agoglib is no longer gnome specific