Главная » Просмотр файлов » Стандарт языка Си С99 TC

Стандарт языка Си С99 TC (1113411), страница 23

Файл №1113411 Стандарт языка Си С99 TC (Стандарт языка Си С99 + TC) 23 страницаСтандарт языка Си С99 TC (1113411) страница 232019-04-24СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 23)

Thus, the only operator that can be applied to an array declared with storage-class specifierregister is sizeof.98Language§6.7.1WG14/N12566Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3If an aggregate or union object is declared with a storage-class specifier other thantypedef, the properties resulting from the storage-class specifier, except with respect tolinkage, also apply to the members of the object, and so on recursively for any aggregateor union member objects.Forward references: type definitions (6.7.7).6.7.2 Type specifiersSyntax1type-specifier:voidcharshortintlongfloatdoublesignedunsigned_Bool_Complexstruct-or-union-specifierenum-specifiertypedef-name∗Constraints2At least one type specifier shall be given in the declaration specifiers in each declaration,and in the specifier-qualifier list in each struct declaration and type name.

Each list oftype specifiers shall be one of the following sets (delimited by commas, when there ismore than one set on a line); the type specifiers may occur in any order, possiblyintermixed with the other declaration specifiers.— void— char— signed char— unsigned char— short, signed short, short int, or signed short int— unsigned short, or unsigned short int— int, signed, or signed int§6.7.2Language99ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256— unsigned, or unsigned int— long, signed long, long int, or signed long int— unsigned long, or unsigned long int— long long, signed long long, long long int, orsigned long long int— unsigned long long, or unsigned long long int— float— double— long double— _Bool— float _Complex— double _Complex— long double _Complex∗— struct or union specifier— enum specifier— typedef name3The type specifier _Complex shall not be used if the implementation does not providecomplex types.104)Semantics4Specifiers for structures, unions, and enumerations are discussed in 6.7.2.1 through6.7.2.3.

Declarations of typedef names are discussed in 6.7.7. The characteristics of theother types are discussed in 6.2.5.5Each of the comma-separated sets designates the same type, except that for bit-fields, it isimplementation-defined whether the specifier int designates the same type as signedint or the same type as unsigned int.Forward references: enumeration specifiers (6.7.2.2), structure and union specifiers(6.7.2.1), tags (6.7.2.3), type definitions (6.7.7).∗104) Freestanding implementations are not required to provide complex types.100Language§6.7.2WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC36.7.2.1 Structure and union specifiersSyntax1struct-or-union-specifier:struct-or-union identifieropt { struct-declaration-list }struct-or-union identifierstruct-or-union:structunionstruct-declaration-list:struct-declarationstruct-declaration-list struct-declarationstruct-declaration:specifier-qualifier-list struct-declarator-list ;specifier-qualifier-list:type-specifier specifier-qualifier-listopttype-qualifier specifier-qualifier-listoptstruct-declarator-list:struct-declaratorstruct-declarator-list , struct-declaratorstruct-declarator:declaratordeclaratoropt : constant-expressionConstraints2A structure or union shall not contain a member with incomplete or function type (hence,a structure shall not contain an instance of itself, but may contain a pointer to an instanceof itself), except that the last member of a structure with more than one named membermay have incomplete array type; such a structure (and any union containing, possiblyrecursively, a member that is such a structure) shall not be a member of a structure or anelement of an array.3The expression that specifies the width of a bit-field shall be an integer constantexpression with a nonnegative value that does not exceed the width of an object of thetype that would be specified were the colon and expression omitted.

If the value is zero,the declaration shall have no declarator.4A bit-field shall have a type that is a qualified or unqualified version of _Bool, signedint, unsigned int, or some other implementation-defined type.§6.7.2.1Language101ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256Semantics5As discussed in 6.2.5, a structure is a type consisting of a sequence of members, whosestorage is allocated in an ordered sequence, and a union is a type consisting of a sequenceof members whose storage overlap.6Structure and union specifiers have the same form.

The keywords struct and unionindicate that the type being specified is, respectively, a structure type or a union type.7The presence of a struct-declaration-list in a struct-or-union-specifier declares a new type,within a translation unit. The struct-declaration-list is a sequence of declarations for themembers of the structure or union. If the struct-declaration-list contains no namedmembers, the behavior is undefined. The type is incomplete until after the } thatterminates the list.8A member of a structure or union may have any object type other than a variablymodified type.105) In addition, a member may be declared to consist of a specifiednumber of bits (including a sign bit, if any). Such a member is called a bit-field;106) itswidth is preceded by a colon.9A bit-field is interpreted as a signed or unsigned integer type consisting of the specifiednumber of bits.107) If the value 0 or 1 is stored into a nonzero-width bit-field of type_Bool, the value of the bit-field shall compare equal to the value stored.10An implementation may allocate any addressable storage unit large enough to hold a bitfield.

If enough space remains, a bit-field that immediately follows another bit-field in astructure shall be packed into adjacent bits of the same unit. If insufficient space remains,whether a bit-field that does not fit is put into the next unit or overlaps adjacent units isimplementation-defined. The order of allocation of bit-fields within a unit (high-order tolow-order or low-order to high-order) is implementation-defined. The alignment of theaddressable storage unit is unspecified.11A bit-field declaration with no declarator, but only a colon and a width, indicates anunnamed bit-field.108) As a special case, a bit-field structure member with a width of 0indicates that no further bit-field is to be packed into the unit in which the previous bitfield, if any, was placed.105) A structure or union can not contain a member with a variably modified type because member namesare not ordinary identifiers as defined in 6.2.3.106) The unary & (address-of) operator cannot be applied to a bit-field object; thus, there are no pointers toor arrays of bit-field objects.107) As specified in 6.7.2 above, if the actual type specifier used is int or a typedef-name defined as int,then it is implementation-defined whether the bit-field is signed or unsigned.108) An unnamed bit-field structure member is useful for padding to conform to externally imposedlayouts.102Language§6.7.2.1WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC312Each non-bit-field member of a structure or union object is aligned in an implementationdefined manner appropriate to its type.13Within a structure object, the non-bit-field members and the units in which bit-fieldsreside have addresses that increase in the order in which they are declared.

A pointer to astructure object, suitably converted, points to its initial member (or if that member is abit-field, then to the unit in which it resides), and vice versa. There may be unnamedpadding within a structure object, but not at its beginning.14The size of a union is sufficient to contain the largest of its members. The value of atmost one of the members can be stored in a union object at any time. A pointer to aunion object, suitably converted, points to each of its members (or if a member is a bitfield, then to the unit in which it resides), and vice versa.15There may be unnamed padding at the end of a structure or union.16As a special case, the last element of a structure with more than one named member mayhave an incomplete array type; this is called a flexible array member.

In most situations,the flexible array member is ignored. In particular, the size of the structure is as if theflexible array member were omitted except that it may have more trailing padding thanthe omission would imply. However, when a . (or ->) operator has a left operand that is(a pointer to) a structure with a flexible array member and the right operand names thatmember, it behaves as if that member were replaced with the longest array (with the sameelement type) that would not make the structure larger than the object being accessed; theoffset of the array shall remain that of the flexible array member, even if this would differfrom that of the replacement array. If this array would have no elements, it behaves as ifit had one element but the behavior is undefined if any attempt is made to access thatelement or to generate a pointer one past it.17EXAMPLEAfter the declaration:struct s { int n; double d[]; };the structure struct s has a flexible array member d.

A typical way to use this is:int m = /* some value */;struct s *p = malloc(sizeof (struct s) + sizeof (double [m]));and assuming that the call to malloc succeeds, the object pointed to by p behaves, for most purposes, as ifp had been declared as:struct { int n; double d[m]; } *p;(there are circumstances in which this equivalence is broken; in particular, the offsets of member d mightnot be the same).18Following the above declaration:§6.7.2.1Language103ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007struct s t1 = { 0 };struct s t2 = { 1, { 4.2 }};t1.n = 4;t1.d[0] = 4.2;////////WG14/N1256validinvalidvalidmight be undefined behaviorThe initialization of t2 is invalid (and violates a constraint) because struct s is treated as if it did notcontain member d.

Характеристики

Тип файла
PDF-файл
Размер
3,61 Mb
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Зачем заказывать выполнение своего задания, если оно уже было выполнено много много раз? Его можно просто купить или даже скачать бесплатно на СтудИзбе. Найдите нужный учебный материал у нас!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6390
Авторов
на СтудИзбе
307
Средний доход
с одного платного файла
Обучение Подробнее