C vs C++ (Objective-C vs Objective-C++) for iPhone

后端 未结 8 1732
余生分开走
余生分开走 2021-02-01 22:58

I would like to create a portable library for iPhone, that also could be used for other platforms.

My question is the fallowing:

Does anyone knows what is the be

8条回答
  •  一向
    一向 (楼主)
    2021-02-01 23:34

    Go for C or C++ - I do not see any reason for recommending one over the other without knowing more about your goals.

    In terms of memory usage, C++ and C do demand more disciplined coding. In terms of speed, C and C++ will in virtually any case be faster than any ObjC/ObjC++ solution. I do frequently mix my Objective C applications with C and C++ code and was always pleased with the results. As Jonathan correctly stated, ObjectiveC++ is mostly a bridge for using C++ code/libraries within your Objective C application/s.

    You can freely use C++ objects from within Objective C++. You can however NOT use Objective C/C++ objects within C++. So its a one-way-road. To overcome any limitations imposed by this restriction, simply wrap your C++ objects with Objective C++ classes where needed.

提交回复
热议问题