&是什么QUOT; Objective-C的是C的一个超集比C ++&QUOT更加严格的;究竟是什么意思?

问题描述:

从我读有:Why是Objective-C的不是很受欢迎的苹果社区之外?

目标-C是C的一个超集(比C ++更严格,事实上),所以不会出现向后兼容的问题。任何你可以在C你可以在Objective-C做的。

Objective-C is a superset of C (much more strictly than C++, in fact) so the issue of backward compatibility does not arise. Anything you can do in C you can do in Objective-C.

作为一个超集是二进制的,就像是pregnant。 OBJ-C是C的超集,C ++是没有的。

Being a superset is binary, like being pregnant. Obj-C is a superset of C, and C++ is not.

什么是他们通过超是什么意思?在哪些方面客观-C会更接近//向后兼容到C?以何种方式做客观-C遵循C理念更加紧密比C ++?

What do they mean by superset? In what way does objective-C would be more close//backward compatible to C? In what way does objective-C follow the C philosophy more closely than C++?

能否任何C程序被一个客观的C编译器(100%兼容)无需修改编译的?

Can any C program be compiled without modification by a objective-C compiler (100% compatibility)?

这更是一个关于编程语言设计和兼容性比战争有关哪一个更好的问题。

This is more a question about programming language design and compatibility than a wars about which one is better.

我prepared一个简单的示意图。是不是很pretty,但希望得到跨越点:

I prepared a simple diagram; it is not very pretty, but hopefully gets the point across:


  • 红色:设置在C,C ++和Objective-C的所有有效的程序(比较小)

  • 绿色中集C和Objective-C在C时有效,但无效的所有程序++(甚至更小)

  • 灰色:设定目标C和C ++在C时有效,但无效的所有程序(空的,据我所知)

  • 蓝:设定的唯一目标C有效的所有程序的(比较大的)

  • 黄色:设定的所有程序只能在C ++有效(最大)

  • Red: the set of all programs valid in C, C++, and Objective-C (relatively small)
  • Green: the set of all programs valid in C and Objective-C, but invalid in C++ (even smaller)
  • Gray: the set of all programs valid in Objective C and C++, but invalid in C (empty, as far as I know)
  • Blue: the set of all programs valid only in Objective C (relatively large)
  • Yellow: the set of all programs valid only in C++ (largest)

该组有效的C程序(在红色和绿色)是一套有效的目标C程序(蓝色)

The set of valid C programs (in red and green) is an strict subset of the set of valid Objective C programs (blue)