问题描述
我想知道为什么C和C ++的FILE类型用大写字母拼写.其他类型则用小写字母拼写.
I was wondering why C's and C++'s FILE type is spelled with capital letters. Other types are spelled with lower case letters.
编辑,请参见C ++ 11第27.9.2节,表134
Edit see § 27.9.2 of C++11, table 134
推荐答案
在C的很老的方言中,在没有任何标准化之前,发明了FILE类型时以及在typedef存在之前,这个名字是一个宏:
In very old dialects of C, before there was any of standardization, when the FILE type was invented, and before typedef existed, that name was a macro:
#define FILE struct _iobuf
惯例是要使用所有大写字母命名宏.
The convention was to have macros named in all uppercase.
http://minnie.tuhs.org/cgi -bin/utree.pl?file = V7/usr/include/stdio.h
(小写的宏只是函数的优化版本-许多也作为适当的函数存在)
(the macros that were in lowercase were simply optimized versions of functions - many of them also existed as proper functions)
这篇关于为什么std :: FILE用大写字母表示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!