为什么"&的fopen QUOT;功能不使用枚举? [英] Why "fopen" function does not use enumerations?
本文介绍了为什么"&的fopen QUOT;功能不使用枚举?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是使用的原因为const char *
像这样选择开放模式,而不是一个枚举
的
What is the reason to use a const char*
for selecting the open mode instead of an enum
like this:
enum open_mode {
READ,
READ_BINARY,
WRITE,
...
};
这不会是更简单地用一个枚举?
It wouldn't be more simply to use an enum?
推荐答案
原因是最有可能的历史:功能的fopen
一直围绕在前期K&安培;中的R版本的语言,而枚举
已被添加到该语言只为ANSI标准
The reason is most likely historical: function fopen
has been around in the early K&R version of the language, while enum
has been added to the language only for the ANSI standard.
的时候,加入枚举
S中的语言一直在这样wides $ P $垫使用,改变等重要功能的签名是不切实际的。
By the time enum
s were added the language has been in such widespread use that changing the signature of such important function was impractical.
这篇关于为什么"&的fopen QUOT;功能不使用枚举?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文