5 ms·
If I were starting a new project in C, I would definitely rely on a solid foundation library like APR[0] or CoreFoundation[1] without reimplementing a bunch of
by rwbt 7y ago
If I were starting a new project in C, I would definitely rely on a solid foundation library like APR[0] or CoreFoundation[1] without reimplementing a bunch of fundamental data structure algorithms by myself. Glib is another alternative, but too bloated in my view.
[0] - https://apr.apache.org https://apr.apache.org
[1] - https://github.com/opensource-apple/CF https://github.com/opensource-apple/CF
- big_chungus 7y agoWhen I use C, it's typically for performance reasons. I need to do funny things with pointers and bit-wise arithmetic that I can't do in higher-level languages because I'm operating in cases where a few more instructions per loop iteration matter. I usually end up re-implementing very fast, cut-down versions of data structures that work only on a tightly-bounded input set for maximum performance (e.g. very fast hash table for IP addresses recently). This approach doesn't work for the cases where C really shines.
- codetrotter 7y agoNote that the GitHub link you have there is an unofficial mirror and the git version history consists simply of the official source dumps. To each their own but IMO repositories created in that manner are generally not very useful (though there are exceptions). The official location of the CoreFoundation (actually CFLite) source dumps is https://opensource.apple.com/tarballs/CF/ https://opensource.apple.com/tarballs/CF/ The most recent CFLite tarball is https://opensource.apple.com/tarballs/CF/CF-1153.18.tar.gz https://opensource.apple.com/tarballs/CF/CF-1153.18.tar.gz You can browse the CFLite source online at the official location as well: https://opensource.apple.com/source/CF/CF-1153.18/ https://opensource.apple.com/source/CF/CF-1153.18/ The docs for CoreFoundation are at https://developer.apple.com/documentation/corefoundation https://developer.apple.com/documentation/corefoundation
- comex 7y agoThese days you’re probably better off using the version of CoreFoundation that’s maintained as part of the Swift project: https://github.com/apple/swift-corelibs-foundation/tree/master/CoreFoundation https://github.com/apple/swift-corelibs-foundation/tree/mast... ...as it’s more up-to-date and developed in the open.
- saagarjha 7y agoI wouldn’t go as far as to say it’s “developed in the open”. It’s significantly more opaque than Swift or WebKit, for example; I’d describe it as “accepting of patches”.
- codr7 7y agoIn that case I would rather go all in and use C++, C is all about control and flexibility.