Linux 为什么create系统调用叫creat?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8390979/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why create system call is called creat?
提问by Beginner
Why create system call is called creat
?
为什么调用 create 系统调用creat
?
Also, why a define for a buffer size is called BUFSIZ
and not BUFSIZE
?
另外,为什么调用缓冲区大小的定义BUFSIZ
而不是调用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'.”
采纳答案by cnicutar
回答by drdwilcox
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.
你必须记住,在过去,记忆是非常宝贵的。编译器的最大变量名长度很短是很常见的。我在最大长度为 3 的系统上工作。许多早期的 C 编译器将变量名限制为 6 个字符。
回答by jstarek
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...
我最喜欢的 unixoid 系统上的短名称疯狂示例是 umount 命令(请参阅 unix.stackexchange.org 上的“为什么 'umount' 不拼写为 'unmount'?”线程以获得解释,再一次,一个 6 -字母限制)。比较多年来在所有这些数千名 Unix 用户中通过少输入一个字母所节省的时间与阅读联机帮助页和咨询信息所花费的时间将是非常有趣的……
回答by Michael Krelin - hacker
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.
回到 那个时代pdp-11
,有一种称为 的编码radix50
,将三个字符(来自有限集合)打包成一个 16 位字。这引入了文件名 6 个字母和扩展名 3 个字母、标识符 6 个字母等的限制。
That said, it doesn't explain creat
in no way.
也就是说,它没有任何解释creat
。