Код: Выделить всё
*.cКод: Выделить всё
#include
int get_buff(int id, int** buff)
{
static int empty[128];
switch(id)
{
case 0:
*buff = empty;
return 0;
default:
return -1;
}
}
int main()
{
int* from;
get_buff(1, &from);
int to[128];
memcpy(to, from, sizeof(to));
return 0;
}
< /code>
приведет к следующему предупреждению с GCC 14: < /p>
main.c:22:5: warning: use of uninitialized value ‘from’ [CWE-457] [-Wanalyzer-use-of-uninitialized-value]Но если я положу get_buff в отдельный C-файл (
Код: Выделить всё
get_buff.cПодробнее здесь: https://stackoverflow.com/questions/797 ... tion-units
Мобильная версия