4 ms·
the one time i was poking around in the source files for the C standard library, the implementation for a given function was always in a similarly-named source
by allenbrunson 17y ago
the one time i was poking around in the source files for the C standard library, the implementation for a given function was always in a similarly-named source file. printf() was in printf.c, and so on.
so let's say you're implementing unix on a machine that has a five-character filename limit, and you want to follow that rule. creat.c is going to implement creat().
that would explain why he now thinks it's a mistake: he could have implemented create() in creat.c, but chose convention over forward-thinking.
- cpr 17y agoI'm pretty sure Unix even in its most primitive forms never had a 5-character filename limit. It might have been 8 initially, but not less than that.
- allenbrunson 17y agoyeah, i admit, i'm kind of reaching. i am sure i read a story about where the original limitation came from, i just can't remember the details. maybe it had something to do with kernel functions versus library functions? creat(), read(), write(), etc were all part of the early unix kernel, and were accessed via call gate or syscall or something, whereas printf() and friends were part of a library, and didn't require a trip into kernel-land, and therefore weren't under the same restrictions. something like that.