gpt4 book ai didi

c - 行尾(GNU 文档)

转载 作者:太空狗 更新时间:2023-10-29 17:22:43 26 4
gpt4 key购买 nike

我正在阅读有关 gcc 预处理的文档,我阅读了以下句子 ( here ):

If the last line of any input file lacks an end-of-line marker, the end of the file is considered to implicitly supply one. The C standard says that this condition provokes undefined behavior, so GCC will emit a warning message.

我尝试通过以下方式产生警告:

> echo -n "int main(void) {return 0;}" > test.c
> gcc -Wall -Wextra -Werror test.c

但没问题,它可以编译。我将行尾标记理解为换行符,但它似乎是其他任何东西。

我怎样才能产生警告?

最佳答案

它似乎已从 gcc 中删除。

看这个: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14331#c19

2007-05-31

    PR preprocessor/14331
* lex.c (_cpp_get_fresh_line): Don't warn if no newline at EOF.

关于c - 行尾(GNU 文档),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34373590/

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