3 ms·
What are the alternatives to these libc functions? Making C even more bare bones than it already is makes no sense.
by wheelerof4te 4y ago
What are the alternatives to these libc functions?
Making C even more bare bones than it already is makes no sense.
- sfpotter 4y agoHe explains in the article…
- pavlov 4y agoFor many things there are much better versions of the functions available in the operating system. For example on macOS you really should be using Core Foundation for strings, dates, etc. In a cross-platform application you can create a platform layer that wraps OS API usage and provides a POSIX fallback for the platforms you don't directly implement.
- marssaxman 4y agoIt's not as strange as you might think. Back in the classic Macintosh era (pre-OS X), it was quite common to write programs in C which essentially ignored libc. It was not a Unix system, so C's filesystem API made for an awkward fit, and the system's native callback-based IO was more efficient anyway. For similar reasons Mac programmers had little use for C's string functions or its allocator. Nor was there any terminal, so printf had little value. I never spent any time in the early DOS/Windows world, but from what I heard similar coding patterns were found there.
- icedchai 4y agoI learned C on the Amiga, and similar patterns were often followed. Example: we generally used the platform-specific AllocMem instead of malloc, even though a mostly complete C library implementation was available. One reason was AllocMem gave you finer control of what sort of memory was allocated (Amiga had "chip" memory, "fast" memory, and other oddities I now forget.)