extern 在 Objective C 中做什么?

发布于 2024-10-02 07:28:03 字数 80 浏览 0 评论 0原文

如果您在目标 C 文件中 extern 一个 C++ 方法(而不是变量),这会做什么?它可以让你做什么?尤其是在 iPhone 应用程序的背景下。

If you extern a C++ method (not a variable) in an objective C file, what does this even do? What does it allow you to do? Especially in the context of an iPhone app.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

最近可好 2024-10-09 07:28:03

它允许您调用驻留在 C 文件外部的方法

It allows you to call a method which resides externally of your C file

っ左 2024-10-09 07:28:03

extern 是一个 C 关键字,它允许程序员指定一些可以导出到其他模块的构造(函数或变量)。

据说 C 支持模块化,但不允许模块的实现和接口正确分离(因此没有封装)。 extern 就是它所提供的一切。

这里是一个供您注意的链接。

extern is a C keyword that lets the programmer specify some construct (function or variable) that can be exported to other modules.

Is is said that C supports modularization but he does not permit a correct separation from implementation and interface of a module (so no encapsulation). extern is all it offers.

Here's a link for your attention.

So要识趣 2024-10-09 07:28:03

C++ 方法基本上是一个 C 函数,C 函数默认是 extern (无论如何在原型中)。它只是意味着该函数没有在那里实现,尽管通常这意味着它在另一个编译单元(文件)中。显然,大多数 C 函数/C++ 方法都是在另一个文件中实现的,这就是为什么它们默认是 extern 的。长话短说,它什么也没做。

A C++ method is basically a C function, C functions are extern by default (in the prototype anyway). It just means that the function is not implemented there, although usually it means that its in another compilation unit (file). Obviously, most C functions / C++ methods are implemented in another file, which is why they are extern by default. Long story short, it does nothing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文