Quake 源代码中我无法理解的符号(C)

发布于 2024-10-06 00:24:50 字数 376 浏览 5 评论 0原文

我在查看 Quake 1 GPL 代码时遇到了各种类似的头文件,但我似乎不明白它们的目的或用途。它们看起来像某种表格,并且结构如下

{1, 0},
{1, -1},
{1, -2},
{1, -3},
{1, -4},
{1, -5},[...]

,前后没有任何内容。我理解它们定义了一些东西,但我从未在 C 中遇到过这种符号。 您可以在此处阅读我引用的头文件之一。

我的问题是:那些……东西是什么? ASM 实际上给我带来的问题比那些东西要少。

I was taking a look at the Quake 1 GPL Code and I came across various similar header files, the purpose or use of which I don't seem to understand. They look like tables of some sorts and are structured like this

{1, 0},
{1, -1},
{1, -2},
{1, -3},
{1, -4},
{1, -5},[...]

Without anything before or after them. I understand they define something but I've never come across this kind of notation in C.
You can read one of the header files I'm referring to here.

My question is: what are those...things? The ASM is actually giving me less problems than that stuff.

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

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

发布评论

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

评论(3

离旧人 2024-10-13 00:24:50

这些可能是多用途的。它们可以像这样使用:

struct {int y; int y;} points[] = {
#include <points.inl>
};

These are probably multi-use includes. They can be used like so:

struct {int y; int y;} points[] = {
#include <points.inl>
};
枕头说它不想醒 2024-10-13 00:24:50

标头的内容不必必须是有效的 C; C 预处理器将在找到 #include 指令的任何位置插入它们,例如在另一个源文件中的结构初始化中间。只要它在实际到达编译器时是有效的 C,那就很重要了。

The contents of a header do not have to be valid C; the C preprocessor will insert them wherever the #include directive is found, such as in the middle of a struct initialization in another source file. As long as it's valid C by the time it actually gets to the compiler, that's all that matters.

蓝礼 2024-10-13 00:24:50

它们可用于初始化数组。

你可以像这样使用它们:

int array[N][2] =
#include <header_file>
;

They can be used to initialize arrays.

You could use them like this:

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