问题
Why create system call is called creat
?
Also, why a define for a buffer size is called BUFSIZ
and not BUFSIZE
?
Are there any other such examples?
Related: (taken from comments)
What did Ken Thompson mean when he said, “I'd spell create with an 'e'.”
回答1:
From LSP (page 28):
Yes, this function’s name is missing an e. Ken Thompson, the creator of Unix, once joked that the missing letter was his largest regret in the design of Unix.
回答2:
Back in the time of pdp-11, there was an encoding called radix50, packing three characters (from a limited set) into one 16 bits word. That introduced the limitation of 6 letters for filename and 3 for extension, 6 letters for identifier, etc.
That said, it doesn't explain creat
in no way.
回答3:
You have to remember that memory was very valuable in the old days. It was common for compilers to have very short maximum variable name lengths. I worked on systems with max lengths of 3. Many of the early C compilers limited variable names to 6 characters.
回答4:
My favourite example of the short-name-madness on unixoid systems is the umount command (see the "Why is 'umount' not spelled 'unmount'?" thread over on unix.stackexchange.org for an explanation, once again, a six-letter-limit). It would be very interesting to compare the time saved by having one letter less to type with the time invested for reading manpages and consulting info, over all those thousands of Unix users over the years...
来源:https://stackoverflow.com/questions/8390979/why-create-system-call-is-called-creat