为什么不将命名空间功能添加到标准C? [英] Why not add namespace feature into standard C?

查看:98
本文介绍了为什么不将命名空间功能添加到标准C?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于许多现代计算机语言具有内置命名空间

功能,我无法理解为什么不将此功能添加到标准C中。

我'听说很多人抱怨C中缺少命名空间。当然,命名空间并没有消除名称污染,但它有助于提供更多的b
$ b函数名前面的一些前缀。是因为

添加命名空间会使C更复杂或其他一些原因吗?

Since many of the modern computer languages have built-in namespace
features, I can''t understand why not add this feature into standard C.
I''ve heard many people complain of the lacking of namespace in C. Of
course, namespace doesn''t eliminate name polution, but it helps more
than just to put some prefix before a function name. Is it because
adding namespace will make C more complex or some other reasons?

推荐答案

工具。 .. @ 163.com写道:
toolmas...@163.com wrote:
由于许多现代计算机语言都有内置的命名空间
功能,我无法理解为什么不将此功能添加到标准C.
我听说很多人都抱怨C中缺少命名空间。当然,命名空间并没有消除名称污染,但它有助于更​​多而不仅仅是在函数名前添加一些前缀。是因为添加命名空间会使C更复杂或其他一些原因吗?
Since many of the modern computer languages have built-in namespace
features, I can''t understand why not add this feature into standard C.
I''ve heard many people complain of the lacking of namespace in C. Of
course, namespace doesn''t eliminate name polution, but it helps more
than just to put some prefix before a function name. Is it because
adding namespace will make C more complex or some other reasons?




如果你没有,可能值得考虑问这个问题在

comp.c.std。

我的(不是特别知情的)意见。回复。


1.来自C ++的任何东西我会小心翼翼地看。 C不是C ++也不应该是。

2.反之,名称空间似乎不是特别OO或

强烈

C ++之类的。

3.在标准中添加*任何*会使C更复杂

4.我认为C99的某些功能太过分了广泛传播


不采用表明其他人也这么认为。 (我喜欢bool :-)



我会对其他(更明智的)意见感兴趣

-

Nick Keighley



If you didn''t, it might be worth considering asking this question in
comp.c.std.
My (not particularly informed) opinion.follows.

1. anything from C++ I''d view... warily. C is not C++ nor should it be.
2. contrai-wise, namespaces don''t seem to be particularly OO or
strongly
C++ like.
3. adding *anything* to the standard is going make C more complex
4. I think some features of C99 were a step too far and its wide-spread

non-adoption indicates other people think the same. (I liked bool :-)
)
I''ll be interested in other (better informed) opinions
--
Nick Keighley




Nick Keighley写道:

Nick Keighley wrote:
2.反之,名称空间似乎不是特别强大或强烈地像C ++一样。
是的,但我并不是说命名空间应该是OO功能才能将
添加到C中。我认为C需要命名空间因为我认为命名空间

改进了C代码组织。

3.在标准中添加*任何*会使C更复杂
是的。所以问题在于是否值得添加。而且我认为是。

4.我认为C99的一些功能是一个步骤太远而且其广泛传播不采用表明其他人也这么认为。 (我喜欢bool: - )
2. contrai-wise, namespaces don''t seem to be particularly OO or
strongly
C++ like. Yes, but I don''t mean namespace should be an OO feature before it can
be added into C. I think C needs namespace because I think namespace
improves C code organization.
3. adding *anything* to the standard is going make C more complex Yes. So the problem is whether it is worth adding. And I think it is.
4. I think some features of C99 were a step too far and its wide-spread

non-adoption indicates other people think the same. (I liked bool :-)



同意。


Agree.


" Nick Keighley" < NI ****************** @ hotmail.com>写道:
"Nick Keighley" <ni******************@hotmail.com> writes:
toolmas ... @ 163.com写道:
toolmas...@163.com wrote:
由于许多现代计算机语言都有内置的命名空间
功能,我可以''理解为什么不将此功能添加到标准C中。
我听说很多人抱怨C中缺少命名空间。当然,命名空间并没有消除名称污染,但它有助于更多
而不仅仅是在函数名称之前添加一些前缀。是否因为添加命名空间会使C更复杂或其他一些原因?
如果你没有,可能值得考虑在
comp.c.std中提出这个问题。我的(不是特别知情的)意见。回复。

1.来自C ++的任何事情我都会谨慎地看待。 C不是C ++也不应该是。
Since many of the modern computer languages have built-in namespace
features, I can''t understand why not add this feature into standard C.
I''ve heard many people complain of the lacking of namespace in C. Of
course, namespace doesn''t eliminate name polution, but it helps more
than just to put some prefix before a function name. Is it because
adding namespace will make C more complex or some other reasons?
If you didn''t, it might be worth considering asking this question in
comp.c.std.
My (not particularly informed) opinion.follows.

1. anything from C++ I''d view... warily. C is not C++ nor should it be.




如果我没记错的话,原型(由1989 ANSI C标准添加)

受到启发通过C ++。

2.反之,名称空间似乎不是特别好OO或
强烈地像C ++一样。
3.添加*任何*标准是让C更复杂
4.我认为C99的一些功能是一个步骤太远,其广泛的非采用表明其他人都认为相同。 (我喜欢bool :-)



If I recall correctly, prototypes (added by the 1989 ANSI C standard)
were inspired by C++.
2. contrai-wise, namespaces don''t seem to be particularly OO or
strongly
C++ like.
3. adding *anything* to the standard is going make C more complex
4. I think some features of C99 were a step too far and its wide-spread
non-adoption indicates other people think the same. (I liked bool :-)
)




在我看来,C ++风格的命名空间可以添加到C中而不会太多
$ b $很难,而且没有大幅增加语言的复杂性。另一方面,任何附加功能都会使

语言变得更复杂,并且必须在某处绘制线条。


当然后向兼容性可能也是一个问题。如果

语言今天从头开始设计名称空间,

标准库声明可以在单个

命名空间中,或者每个header可以定义自己的命名空间 - 但是如果今天添加了
名称空间,那么从标准头文件中直接引用

声明的现有代码仍然必须工作。 />

-

Keith Thompson(The_Other_Keith) ks***@mib.org < http://www.ghoti.net/~kst>

圣地亚哥超级计算机中心< *> < http://users.sdsc.edu/~kst>

我们必须做点什么。这是事情。因此,我们必须这样做。



In my opinion, C++-style namespaces could be added to C without too
much difficulty, and without drastically increasing the complexity of
the language. On the other hand, any additional feature will make the
language more complex, and the line has to be drawn somewhere.

And of course backward compatibility could also be an issue. If the
language were being designed from scratch today with namespaces,
either the standard library declarations could be in a single
namespace, or each header could define its own namespace -- but if
namespaces were added today, existing code that refers directly to
declarations from the standard headers would still have to work.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.


这篇关于为什么不将命名空间功能添加到标准C?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆