Zhi*_*lin 2 c gcc declaration function
这是我的代码(简化):
#include <stdio.h>
#include <string.h>
#define SIZE 240
int main(void)
{
char word[SIZE];
gets(word);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
为什么海湾合作委员会给我
?3.c: In function ‘main’:
?3.c:13:2: warning: implicit declaration of function ‘gets’ [-Wimplicit-function-declaration]
这警告?
GCC vesion是5.2.1
PST程序正在运行.
PPS我永远不会使用gets(),我永远不会使用gets(),我永远不会使用gets(),我永远不会使用gets()
getsC标准不再支持该功能,因为它是一种不安全的功能.所以似乎函数声明被排除在标题之外<stdio.h>,现在编译器不知道是什么声明了gets.
来自C标准(前言)
6第三版取消并取代第二版ISO/IEC 9899:1999,经ISO/IEC 9899:1999/Cor 1:2001,ISO/IEC 9899:1999/Cor 2:2004和ISO/IEC 9899修正:1999/Cor 3:2007.上一版的主要变化包括:
...
— removed the gets function (<stdio.h>)
Run Code Online (Sandbox Code Playgroud)