English 中文(简体)
目标C++是否是C++和目标C的超级组合?
原标题:Is Objective-C++ a superset of both C++ and Objective-C?

或更实际地说: 如果我根据目标C++汇编一份仅包含奥杰-C法典或仅包含C++代码的文件,我是否可以肯定这些档案与以前的行为完全一致? 它们在哪些方面可能有所不同?

最佳回答

更确切地说,情况确实如此;根据C++或目标C汇编的任何材料都将与目标C++汇编者一起汇编。

然而,在某些方面,这种情况确实存在,而且存在一些行为差异。

然而,我不了解任何具体的日常行为差异。 这些差异一般应在汇编中显示,主要作为C++“强化”类型概念引起的问题。

但是,操作员超负荷工作可能会遇到很大问题。 如果一套法典广泛使用操作员超负荷工作,这在首次将目标C混为一谈时会造成问题。 但是,通常还是作为汇编者警告,而且很少作为时常的 b。

问题回答

Objective-C is a superset of C only. You can mix C++ with Objective-C - that is called Objective-C++ - however there are certain rules that you have to follow.
Here you can see all the rules that have to be followed: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocCPlusPlus.html

EDIT:这是开发商网站的引文:“Apple的“目标-C”汇编者允许你在同一个来源档案中自由混合C++和C的代码。 这个目标C/C++语言混合体称为目标C++。 你们可以利用现有的C++图书馆。

因此,它清楚地指出,C++和C目标组合称为目标C++,但这不是C++的超级编造,而是使用两种语言,有些规则可以一起使用。 (例如,在继承期间,你可以搭配客观和正文课程,但也有其他课程)。

我猜测,至少有一个实例表明有效的目标C代码无效。

void SayHello()
{
    char* this = "hello!";
    printf("%s", this);
}

(如果有人要把这一变量命名,我不知道)





相关问题
Asynchronous request to the server from background thread

I ve got the problem when I tried to do asynchronous requests to server from background thread. I ve never got results of those requests. Simple example which shows the problem: @protocol ...

objective-c: Calling a void function from another controller

i have a void, like -(void) doSomething in a specific controller. i can call it in this controller via [self doSomething], but i don t know how to call this void from another .m file. I want to call ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

NSUndoManager and runModalForWindow:

I have a simple Core Data app which displays a list of entities in the main window. To create or add new entities, I use a second modal window with a separate managed object context so changes can be ...

NSMutableArray values becoming "invalid"

I m trying to show a database information in a tableview and then the detailed information in a view my problem is as follow: I created a NSMutableArray: NSMutableArray *myArray = [[NSMutableArray ...

iPhone numberpad with decimal point

I am writing an iPhone application which requires the user to enter several values that may contain a decimal point (currency values, percentages etc.). The number of decimal places in the values ...

热门标签