gpt4 book ai didi

使用前的 C 声明

转载 作者:行者123 更新时间:2023-12-04 10:29:27 29 4
gpt4 key购买 nike

C 中的所有标识符在使用前都需要声明,但我找不到它在 C99 标准中表示的位置。

我觉得也是指宏定义,不过定义的只是宏展开顺序。

最佳答案

C99:TC3 6.5.1 §2,脚注 79 明确指出:

Thus, an undeclared identifier is a violation of the syntax.

结合 6.2.1 §5:

Unless explicitly stated otherwise, [...] it [ie an identifier] refers to the entity in the relevant name space whose declaration is visible at the point the identifier occurs.

和§7:

[...] Any other identifier has scope that begins just after the completion of its declarator.

关于使用前的 C 声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4804844/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com