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

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

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

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

Inline substitution is not textual substitution, nor does it create a new function.Therefore, for example, the expansion of a macro used within the body of the function uses thedefinition it had at the point the function body appears, and not where the function is called; andidentifiers refer to the declarations in scope where the body occurs. Likewise, the function has asingle address, regardless of the number of inline definitions that occur in addition to the externaldefinition.121) For example, an implementation might never perform inline substitution, or might only perform inlinesubstitutions to calls in the scope of an inline declaration.122) Since an inline definition is distinct from the corresponding external definition and from any othercorresponding inline definitions in other translation units, all corresponding objects with static storageduration are also distinct in each of the definitions.§6.7.4Language113ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N12566.7.5 DeclaratorsSyntax1declarator:pointeropt direct-declaratordirect-declarator:identifier( declarator )direct-declarator [ type-qualifier-listopt assignment-expressionopt ]direct-declarator [ static type-qualifier-listopt assignment-expression ]direct-declarator [ type-qualifier-list static assignment-expression ]direct-declarator [ type-qualifier-listopt * ]direct-declarator ( parameter-type-list )direct-declarator ( identifier-listopt )pointer:* type-qualifier-listopt* type-qualifier-listopt pointertype-qualifier-list:type-qualifiertype-qualifier-list type-qualifierparameter-type-list:parameter-listparameter-list , ...parameter-list:parameter-declarationparameter-list , parameter-declarationparameter-declaration:declaration-specifiers declaratordeclaration-specifiers abstract-declaratoroptidentifier-list:identifieridentifier-list , identifierSemantics2Each declarator declares one identifier, and asserts that when an operand of the sameform as the declarator appears in an expression, it designates a function or object with thescope, storage duration, and type indicated by the declaration specifiers.3A full declarator is a declarator that is not part of another declarator.

The end of a fulldeclarator is a sequence point. If, in the nested sequence of declarators in a full114Language§6.7.5WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3declarator, there is a declarator specifying a variable length array type, the type specifiedby the full declarator is said to be variably modified. Furthermore, any type derived bydeclarator type derivation from a variably modified type is itself variably modified.4In the following subclauses, consider a declarationT D1where T contains the declaration specifiers that specify a type T (such as int) and D1 isa declarator that contains an identifier ident. The type specified for the identifier ident inthe various forms of declarator is described inductively using this notation.5If, in the declaration ‘‘T D1’’, D1 has the formidentifierthen the type specified for ident is T .6If, in the declaration ‘‘T D1’’, D1 has the form( D )then ident has the type specified by the declaration ‘‘T D’’.

Thus, a declarator inparentheses is identical to the unparenthesized declarator, but the binding of complicateddeclarators may be altered by parentheses.Implementation limits7As discussed in 5.2.4.1, an implementation may limit the number of pointer, array, andfunction declarators that modify an arithmetic, structure, union, or incomplete type, eitherdirectly or via one or more typedefs.Forward references: array declarators (6.7.5.2), type definitions (6.7.7).6.7.5.1 Pointer declaratorsSemantics1If, in the declaration ‘‘T D1’’, D1 has the form* type-qualifier-listopt Dand the type specified for ident in the declaration ‘‘T D’’ is ‘‘derived-declarator-type-listT ’’, then the type specified for ident is ‘‘derived-declarator-type-list type-qualifier-listpointer to T ’’.

For each type qualifier in the list, ident is a so-qualified pointer.2For two pointer types to be compatible, both shall be identically qualified and both shallbe pointers to compatible types.3EXAMPLE The following pair of declarations demonstrates the difference between a ‘‘variable pointerto a constant value’’ and a ‘‘constant pointer to a variable value’’.§6.7.5.1Language115ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256const int *ptr_to_constant;int *const constant_ptr;The contents of any object pointed to by ptr_to_constant shall not be modified through that pointer,but ptr_to_constant itself may be changed to point to another object. Similarly, the contents of theint pointed to by constant_ptr may be modified, but constant_ptr itself shall always point to thesame location.4The declaration of the constant pointer constant_ptr may be clarified by including a definition for thetype ‘‘pointer to int’’.typedef int *int_ptr;const int_ptr constant_ptr;declares constant_ptr as an object that has type ‘‘const-qualified pointer to int’’.6.7.5.2 Array declaratorsConstraints1In addition to optional type qualifiers and the keyword static, the [ and ] may delimitan expression or *.

If they delimit an expression (which specifies the size of an array), theexpression shall have an integer type. If the expression is a constant expression, it shallhave a value greater than zero. The element type shall not be an incomplete or functiontype. The optional type qualifiers and the keyword static shall appear only in adeclaration of a function parameter with an array type, and then only in the outermostarray type derivation.2An ordinary identifier (as defined in 6.2.3) that has a variably modified type shall haveeither block scope and no linkage or function prototype scope.

If an identifier is declaredto be an object with static storage duration, it shall not have a variable length array type.Semantics3If, in the declaration ‘‘T D1’’, D1 has one of the forms:D[ type-qualifier-listopt assignment-expressionopt ]D[ static type-qualifier-listopt assignment-expression ]D[ type-qualifier-list static assignment-expression ]D[ type-qualifier-listopt * ]and the type specified for ident in the declaration ‘‘T D’’ is ‘‘derived-declarator-type-listT ’’, then the type specified for ident is ‘‘derived-declarator-type-list array of T ’’.123)(See 6.7.5.3 for the meaning of the optional type qualifiers and the keyword static.)4If the size is not present, the array type is an incomplete type. If the size is * instead ofbeing an expression, the array type is a variable length array type of unspecified size,which can only be used in declarations with function prototype scope;124) such arrays arenonetheless complete types.

If the size is an integer constant expression and the element123) When several ‘‘array of’’ specifications are adjacent, a multidimensional array is declared.116Language§6.7.5.2WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3type has a known constant size, the array type is not a variable length array type;otherwise, the array type is a variable length array type.5If the size is an expression that is not an integer constant expression: if it occurs in adeclaration at function prototype scope, it is treated as if it were replaced by *; otherwise,each time it is evaluated it shall have a value greater than zero.

The size of each instanceof a variable length array type does not change during its lifetime. Where a sizeexpression is part of the operand of a sizeof operator and changing the value of thesize expression would not affect the result of the operator, it is unspecified whether or notthe size expression is evaluated.6For two array types to be compatible, both shall have compatible element types, and ifboth size specifiers are present, and are integer constant expressions, then both sizespecifiers shall have the same constant value.

If the two array types are used in a contextwhich requires them to be compatible, it is undefined behavior if the two size specifiersevaluate to unequal values.7EXAMPLE 1float fa[11], *afp[17];declares an array of float numbers and an array of pointers to float numbers.8EXAMPLE 2Note the distinction between the declarationsextern int *x;extern int y[];The first declares x to be a pointer to int; the second declares y to be an array of int of unspecified size(an incomplete type), the storage for which is defined elsewhere.9EXAMPLE 3The following declarations demonstrate the compatibility rules for variably modified types.extern int n;extern int m;void fcompat(void){int a[n][6][m];int (*p)[4][n+1];int c[n][n][6][m];int (*r)[n][n][n+1];p = a;// invalid: not compatible because 4 != 6r = c;// compatible, but defined behavior only if// n == 6 and m == n+1}124) Thus, * can be used only in function declarations that are not definitions (see 6.7.5.3).§6.7.5.2Language117ISO/IEC 9899:TC310Committee Draft — Septermber 7, 2007WG14/N1256EXAMPLE 4 All declarations of variably modified (VM) types have to be at either block scope orfunction prototype scope.

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

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

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

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