为什么文件中的所有大写为FILE *? [英] Why is FILE all-caps as in FILE*?
问题描述
这似乎只是奇怪了吧,其他大部分东西都是小写的。
This just seems odd to me, most other things are lower case.
有一些历史的原因?
推荐答案
这是一个宏。宏在历史上曾在C.不幸的是最近的趋势似乎已经打破了这一事实。全部大写
It's a macro. Macros have historically had all caps in C. Unfortunately recent trends appear to have broken that fact.
小历史课:另外,文件是在UNIX V7 libc中的stdio一个IO缓冲抽象。文件没有必要再present一个物理文件,只是一些可以做块IO。来源:
Small history lesson: Also, FILE was an io buffer abstraction in UNIX v7 libc stdio. A FILE doesn't necessarily represent a physical file, just something that can do block IO. Source:
<一个href=\"http://www.bsdlover.cn/study/UnixTree/V7/usr/include/stdio.h.html\">http://www.bsdlover.cn/study/UnixTree/V7/usr/include/stdio.h.html
文件已经被内核定义,以及:
"file" was already defined by the kernel as well:
<一个href=\"http://www.bsdlover.cn/study/UnixTree/V7/usr/include/sys/file.h.html\">http://www.bsdlover.cn/study/UnixTree/V7/usr/include/sys/file.h.html
至于别人说这里很可能是一个typedef了,但我不认为C的类型定义早在79年,因为它只是刚刚结构。再说我不是天生那就这样...:)
As someone else said here it's probably a typedef now, but I don't think C had typedefs back in '79 as it only just had structs. Then again I wasn't born then so... :)
这篇关于为什么文件中的所有大写为FILE *?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!