内部函数,无法定义 (C)

发布于 2024-09-15 18:26:19 字数 120 浏览 5 评论 0原文

我实现了一个名为abs()的函数。我收到此错误:

内部函数,无法定义

我做错了什么? 我使用的是 Visual Studio 2005。

I implemented a function called abs(). I get this error:

Intrinsic function, cannot be defined

What have I done wrong?
I'm using Visual Studio 2005.

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

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

发布评论

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

评论(4

一笔一画续写前缘 2024-09-22 18:26:19

内部函数,无法定义

在这种情况下,内在意味着编译器已经 有一个名为 abs 的函数实现,您无法重新定义该函数。

解决方案?将函数的名称更改为其他名称,例如snakile_abs

查看有关 abs 函数的 MSDN 文档了解更多信息。

Intrinsic function, cannot be defined

In this case, intrinsic means that the compiler already has an implementation of a function called abs, and which you cannot redefine.

Solution? Change your function's name to something else, snakile_abs for example.

Check the MSDN documentation on the abs function for more information.

风轻花落早 2024-09-22 18:26:19

问题不在于是否在标题中。

问题是无法定义内在函数,即编译器自身识别和实现的函数,通常具有单独在 C 代码中无法实现的优化。

The problem is not being in a header or not.

The problem is that intrinsic functions, i.e., functions that the compiler recognizes and implements itself, generally with optimizations that wouldn't be available in C code alone, cannot be defined.

痴意少年 2024-09-22 18:26:19

所有数学函数的名称(请参阅 math.h)

所有数学函数的名称以“f”或“l”为前缀。

保留用于实施。

The names of all mathematical functions (see math.h)

The names of all mathematical functions prefixed by 'f' or 'l'.

Are reserved for the implementation.

最偏执的依靠 2024-09-22 18:26:19

定义 static int abs(int x) { ... } 应该是合法的,但简单地 int abs(int x) { ... } 具有未定义的行为,因此编译可以做的一件合理的事情就是发出错误。

Defining static int abs(int x) { ... } should be legal, but simply int abs(int x) { ... } has undefined behavior, and thus one reasonable thing a compile could do is issue an error.

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