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

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

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

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

In the expression x[i], which is equivalent to (*((x)+(i))), x is first converted toa pointer to the initial array of five ints. Then i is adjusted according to the type of x, which conceptuallyentails multiplying i by the size of the object to which the pointer points, namely an array of five intobjects. The results are added and indirection is applied to yield an array of five ints. When used in theexpression x[i][j], that array is in turn converted to a pointer to the first of the ints, so x[i][j]yields an int.Forward references: additive operators (6.5.6), address and indirection operators(6.5.3.2), array declarators (6.7.5.2).70Language§6.5.2.1WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC36.5.2.2 Function callsConstraints1The expression that denotes the called function80) shall have type pointer to functionreturning void or returning an object type other than an array type.2If the expression that denotes the called function has a type that includes a prototype, thenumber of arguments shall agree with the number of parameters.

Each argument shallhave a type such that its value may be assigned to an object with the unqualified versionof the type of its corresponding parameter.Semantics3A postfix expression followed by parentheses () containing a possibly empty, commaseparated list of expressions is a function call. The postfix expression denotes the calledfunction. The list of expressions specifies the arguments to the function.4An argument may be an expression of any object type. In preparing for the call to afunction, the arguments are evaluated, and each parameter is assigned the value of thecorresponding argument.81)5If the expression that denotes the called function has type pointer to function returning anobject type, the function call expression has the same type as that object type, and has thevalue determined as specified in 6.8.6.4.

Otherwise, the function call has type void. Ifan attempt is made to modify the result of a function call or to access it after the nextsequence point, the behavior is undefined.6If the expression that denotes the called function has a type that does not include aprototype, the integer promotions are performed on each argument, and arguments thathave type float are promoted to double. These are called the default argumentpromotions. If the number of arguments does not equal the number of parameters, thebehavior is undefined. If the function is defined with a type that includes a prototype, andeither the prototype ends with an ellipsis (, ...) or the types of the arguments afterpromotion are not compatible with the types of the parameters, the behavior is undefined.If the function is defined with a type that does not include a prototype, and the types ofthe arguments after promotion are not compatible with those of the parameters afterpromotion, the behavior is undefined, except for the following cases:80) Most often, this is the result of converting an identifier that is a function designator.81) A function may change the values of its parameters, but these changes cannot affect the values of thearguments.

On the other hand, it is possible to pass a pointer to an object, and the function maychange the value of the object pointed to. A parameter declared to have array or function type isadjusted to have a pointer type as described in 6.9.1.§6.5.2.2Language71ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N1256— one promoted type is a signed integer type, the other promoted type is thecorresponding unsigned integer type, and the value is representable in both types;— both types are pointers to qualified or unqualified versions of a character type orvoid.7If the expression that denotes the called function has a type that does include a prototype,the arguments are implicitly converted, as if by assignment, to the types of thecorresponding parameters, taking the type of each parameter to be the unqualified versionof its declared type.

The ellipsis notation in a function prototype declarator causesargument type conversion to stop after the last declared parameter. The default argumentpromotions are performed on trailing arguments.8No other conversions are performed implicitly; in particular, the number and types ofarguments are not compared with those of the parameters in a function definition thatdoes not include a function prototype declarator.9If the function is defined with a type that is not compatible with the type (of theexpression) pointed to by the expression that denotes the called function, the behavior isundefined.10The order of evaluation of the function designator, the actual arguments, andsubexpressions within the actual arguments is unspecified, but there is a sequence pointbefore the actual call.11Recursive function calls shall be permitted, both directly and indirectly through any chainof other functions.12EXAMPLEIn the function call(*pf[f1()]) (f2(), f3() + f4())the functions f1, f2, f3, and f4 may be called in any order.

All side effects have to be completed beforethe function pointed to by pf[f1()] is called.Forward references: function declarators (including prototypes) (6.7.5.3), functiondefinitions (6.9.1), the return statement (6.8.6.4), simple assignment (6.5.16.1).6.5.2.3 Structure and union membersConstraints1The first operand of the . operator shall have a qualified or unqualified structure or uniontype, and the second operand shall name a member of that type.2The first operand of the -> operator shall have type ‘‘pointer to qualified or unqualifiedstructure’’ or ‘‘pointer to qualified or unqualified union’’, and the second operand shallname a member of the type pointed to.72Language§6.5.2.3WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC3Semantics3A postfix expression followed by the .

operator and an identifier designates a member ofa structure or union object. The value is that of the named member,82) and is an lvalue ifthe first expression is an lvalue. If the first expression has qualified type, the result hasthe so-qualified version of the type of the designated member.4A postfix expression followed by the -> operator and an identifier designates a memberof a structure or union object. The value is that of the named member of the object towhich the first expression points, and is an lvalue.83) If the first expression is a pointer toa qualified type, the result has the so-qualified version of the type of the designatedmember.5One special guarantee is made in order to simplify the use of unions: if a union containsseveral structures that share a common initial sequence (see below), and if the unionobject currently contains one of these structures, it is permitted to inspect the commoninitial part of any of them anywhere that a declaration of the complete type of the union isvisible.

Two structures share a common initial sequence if corresponding members havecompatible types (and, for bit-fields, the same widths) for a sequence of one or moreinitial members.6EXAMPLE 1 If f is a function returning a structure or union, and x is a member of that structure orunion, f().x is a valid postfix expression but is not an lvalue.7EXAMPLE 2In:struct s { int i; const int ci; };struct s s;const struct s cs;volatile struct s vs;the various members have the types:s.is.cics.ics.civs.ivs.ciintconst intconst intconst intvolatile intvolatile const int82) If the member used to access the contents of a union object is not the same as the member last used tostore a value in the object, the appropriate part of the object representation of the value is reinterpretedas an object representation in the new type as described in 6.2.6 (a process sometimes called "typepunning").

This might be a trap representation.83) If &E is a valid pointer expression (where & is the ‘‘address-of ’’ operator, which generates a pointer toits operand), the expression (&E)->MOS is the same as E.MOS.§6.5.2.3Language73ISO/IEC 9899:TC38EXAMPLE 3Committee Draft — Septermber 7, 2007WG14/N1256The following is a valid fragment:union {struct {intalltypes;} n;struct {inttype;intintnode;} ni;struct {inttype;double doublenode;} nf;} u;u.nf.type = 1;u.nf.doublenode = 3.14;/* ... */if (u.n.alltypes == 1)if (sin(u.nf.doublenode) == 0.0)/* ...

*/The following is not a valid fragment (because the union type is not visible within function f):struct t1 { int m; };struct t2 { int m; };int f(struct t1 *p1, struct t2 *p2){if (p1->m < 0)p2->m = -p2->m;return p1->m;}int g(){union {struct t1 s1;struct t2 s2;} u;/* ... */return f(&u.s1, &u.s2);}Forward references: address and indirection operators (6.5.3.2), structure and unionspecifiers (6.7.2.1).74Language§6.5.2.3WG14/N1256Committee Draft — Septermber 7, 2007ISO/IEC 9899:TC36.5.2.4 Postfix increment and decrement operatorsConstraints1The operand of the postfix increment or decrement operator shall have qualified orunqualified real or pointer type and shall be a modifiable lvalue.Semantics2The result of the postfix ++ operator is the value of the operand.

After the result isobtained, the value of the operand is incremented. (That is, the value 1 of the appropriatetype is added to it.) See the discussions of additive operators and compound assignmentfor information on constraints, types, and conversions and the effects of operations onpointers. The side effect of updating the stored value of the operand shall occur betweenthe previous and the next sequence point.3The postfix -- operator is analogous to the postfix ++ operator, except that the value ofthe operand is decremented (that is, the value 1 of the appropriate type is subtracted fromit).Forward references: additive operators (6.5.6), compound assignment (6.5.16.2).6.5.2.5 Compound literalsConstraints1The type name shall specify an object type or an array of unknown size, but not a variablelength array type.2No initializer shall attempt to provide a value for an object not contained within the entireunnamed object specified by the compound literal.3If the compound literal occurs outside the body of a function, the initializer list shallconsist of constant expressions.Semantics4A postfix expression that consists of a parenthesized type name followed by a braceenclosed list of initializers is a compound literal.

It provides an unnamed object whosevalue is given by the initializer list.84)5If the type name specifies an array of unknown size, the size is determined by theinitializer list as specified in 6.7.8, and the type of the compound literal is that of thecompleted array type. Otherwise (when the type name specifies an object type), the typeof the compound literal is that specified by the type name. In either case, the result is anlvalue.84) Note that this differs from a cast expression. For example, a cast specifies a conversion to scalar typesor void only, and the result of a cast expression is not an lvalue.§6.5.2.5Language75ISO/IEC 9899:TC3Committee Draft — Septermber 7, 2007WG14/N12566The value of the compound literal is that of an unnamed object initialized by theinitializer list.

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

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

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

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