The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]



"Проект MOOL развивает средства разработки драйверов ядра Lin..."
Версия для распечатки Пред. тема | След. тема
Форум Разговоры, обсуждение новостей
Исходное сообщение [ Отслеживать ]
Присылайте удачные настройки в раздел примеров файлов конфигурации на WIKI.opennet.ru.
. "Проект MOOL развивает средства разработки драйверов ядра Lin..." +/
Сообщение от dq0s4y71 (ok), 07-Окт-14, 12:40 
Это называется tentative definition. Задокументировано в стандарте C99, если вам нужно точно:

> 6.9.2 External object definitions
> ...
> A declaration of an identifier for an object that has file scope without an initializer, and without a storage-class specifier or with the storage-class specifier static, constitutes a tentative definition.Ifatranslation unit contains one or more tentative definitions for an identifier, and the translation unit contains no external definition for that identifier, then the behavior is exactly as if the translation unit contains a file scope declaration of that identifier, with the composite type as of the end of the translation unit, with an initializer equal to 0.

Это относится не только к структурам, но и, например, к массивам:

int array[];

int * ptr = array;

...

int array[10];

И это правильно :)

Ответить | Правка | Наверх | Cообщить модератору

Оглавление
Проект MOOL развивает средства разработки драйверов ядра Lin..., opennews, 04-Окт-14, 00:33  [смотреть все]
Форумы | Темы | Пред. тема | След. тема



Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру