Why is FILE all-caps as in FILE*? [closed]

北慕城南 提交于 2019-11-29 09:27:33

It's a macro. Macros have historically had all caps in C. Unfortunately recent trends appear to have broken that fact.

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:

http://www.bsdlover.cn/study/UnixTree/V7/usr/include/stdio.h.html

"file" was already defined by the kernel as well:

http://www.bsdlover.cn/study/UnixTree/V7/usr/include/sys/file.h.html

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... :)

It's all caps almost certainly because at least originally it was a macro. Nowadays, chances are pretty good that it's a typedef instead, but nobody changed the name to boot (and doing so would be a pretty lousy idea).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!