Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
2012 / MISRA / EW_MisraCReference.pdf
Скачиваний:
129
Добавлен:
10.02.2015
Размер:
650.9 Кб
Скачать

MISRA C rules reference

Structures and unions

The rules in this section are concerned with the specification and use of structures and unions.

Rule 108 (required) In the specification of a structure or union type, all members of the structure or union shall be fully specified.

How the rule is checked

The compiler will generate an error, indicating a violation of this rule, if a field is declared as an array without a size.

Rule 109 (required) Overlapping storage shall not be used.

How the rule is checked

The compiler will generate an error, indicating a violation of this rule, for a definition or declaration of a union.

Rule 110 (required) Unions shall not be used to access subparts of larger data types.

How the rule is checked

Violations of this rule are not checked for by the compiler or linker.

Rule 111 (required) Bitfields shall only be defined to be of type unsigned int or signed int.

How the rule is checked

The compiler will generate an error, indicating a violation of this rule, if a bitfield is declared to have any type other than unsigned int or signed int.

Note: An error is given if a bitfield is declared to be of type int without using a signed or unsigned specifier.

47

Соседние файлы в папке MISRA