Стандарт C++ 11, страница 7

PDF-файл Стандарт C++ 11, страница 7 Практикум (Прикладное программное обеспечение и системы программирования) (37587): Другое - 4 семестрСтандарт C++ 11: Практикум (Прикладное программное обеспечение и системы программирования) - PDF, страница 7 (37587) - СтудИзба2019-05-09СтудИзба

Описание файла

PDF-файл из архива "Стандарт C++ 11", который расположен в категории "". Всё это находится в предмете "практикум (прикладное программное обеспечение и системы программирования)" из 4 семестр, которые можно найти в файловом архиве МГУ им. Ломоносова. Не смотря на прямую связь этого архива с МГУ им. Ломоносова, его также можно найти и в других разделах. .

Просмотр PDF-файла онлайн

Текст 7 страницы из PDF

— end note ]1.9Program execution[intro.execution]1The semantic descriptions in this International Standard define a parameterized nondeterministic abstractmachine. This International Standard places no requirement on the structure of conforming implementations.In particular, they need not copy or emulate the structure of the abstract machine.

Rather, conformingimplementations are required to emulate (only) the observable behavior of the abstract machine as explainedbelow.52Certain aspects and operations of the abstract machine are described in this International Standard asimplementation-defined (for example, sizeof(int)). These constitute the parameters of the abstract machine. Each implementation shall include documentation describing its characteristics and behavior in theserespects.6 Such documentation shall define the instance of the abstract machine that corresponds to thatimplementation (referred to as the “corresponding instance” below).3Certain other aspects and operations of the abstract machine are described in this International Standard asunspecified (for example, order of evaluation of arguments to a function). Where possible, this International4) Under the “as-if” rule an implementation is allowed to store two objects at the same machine address or not store anobject at all if the program cannot observe the difference (1.9).5) This provision is sometimes called the “as-if” rule, because an implementation is free to disregard any requirement of thisInternational Standard as long as the result is as if the requirement had been obeyed, as far as can be determined from theobservable behavior of the program.

For instance, an actual implementation need not evaluate part of an expression if it candeduce that its value is not used and that no side effects affecting the observable behavior of the program are produced.6) This documentation also includes conditonally-supported constructs and locale-specific behavior. See 1.4.§ 1.98© ISO/IEC 2011 – All rights reservedISO/IEC 14882:2011(E)Standard defines a set of allowable behaviors. These define the nondeterministic aspects of the abstractmachine. An instance of the abstract machine can thus have more than one possible execution for a givenprogram and a given input.4Certain other operations are described in this International Standard as undefined (for example, the effectof attempting to modify a const object).

[ Note: This International Standard imposes no requirements onthe behavior of programs that contain undefined behavior. — end note ]5A conforming implementation executing a well-formed program shall produce the same observable behavioras one of the possible executions of the corresponding instance of the abstract machine with the same programand the same input.

However, if any such execution contains an undefined operation, this InternationalStandard places no requirement on the implementation executing that program with that input (not evenwith regard to operations preceding the first undefined operation).6When the processing of the abstract machine is interrupted by receipt of a signal, the values of objects whichare neither— of type volatile std::sig_atomic_t nor— lock-free atomic objects (29.4)are unspecified during the execution of the signal handler, and the value of any object not in either of thesetwo categories that is modified by the handler becomes undefined.7An instance of each object with automatic storage duration (3.7.3) is associated with each entry into itsblock.

Such an object exists and retains its last-stored value during the execution of the block and while theblock is suspended (by a call of a function or receipt of a signal).8The least requirements on a conforming implementation are:— Access to volatile objects are evaluated strictly according to the rules of the abstract machine.— At program termination, all data written into files shall be identical to one of the possible results thatexecution of the program according to the abstract semantics would have produced.— The input and output dynamics of interactive devices shall take place in such a fashion that promptingoutput is actually delivered before a program waits for input.

What constitutes an interactive deviceis implementation-defined.These collectively are referred to as the observable behavior of the program. [ Note: More stringent correspondences between abstract and actual semantics may be defined by each implementation. — end note ]9[ Note: Operators can be regrouped according to the usual mathematical rules only where the operatorsreally are associative or commutative.7 For example, in the following fragmentint a, b;/∗ ...

∗/a = a + 32760 + b + 5;the expression statement behaves exactly the same asa = (((a + 32760) + b) + 5);due to the associativity and precedence of these operators. Thus, the result of the sum (a + 32760) is nextadded to b, and that result is then added to 5 which results in the value assigned to a. On a machine in whichoverflows produce an exception and in which the range of values representable by an int is [-32768,+32767],the implementation cannot rewrite this expression as7) Overloaded operators are never assumed to be associative or commutative.§ 1.9© ISO/IEC 2011 – All rights reserved9ISO/IEC 14882:2011(E)a = ((a + b) + 32765);since if the values for a and b were, respectively, -32754 and -15, the sum a + b would produce an exceptionwhile the original expression would not; nor can the expression be rewritten either asa = ((a + 32765) + b);ora = (a + (b + 32765));since the values for a and b might have been, respectively, 4 and -8 or -17 and 12.

However on a machine inwhich overflows do not produce an exception and in which the results of overflows are reversible, the aboveexpression statement can be rewritten by the implementation in any of the above ways because the sameresult will occur. — end note ]10A full-expression is an expression that is not a subexpression of another expression. If a language constructis defined to produce an implicit call of a function, a use of the language construct is considered to be anexpression for the purposes of this definition.

A call to a destructor generated at the end of the lifetime ofan object other than a temporary object is an implicit full-expression. Conversions applied to the result ofan expression in order to satisfy the requirements of the language construct in which the expression appearsare also considered to be part of the full-expression.[ Example:struct S {S(int i): I(i) { }int& v() { return I; }private:int I;};S s1(1);S s2 = 2;void f() {if (S(3).v())// full-expression is call of S::S(int)// full-expression is call of S::S(int)// full-expression includes lvalue-to-rvalue and// int to bool conversions, performed before// temporary is deleted at end of full-expression{ }}— end example ]11[ Note: The evaluation of a full-expression can include the evaluation of subexpressions that are not lexicallypart of the full-expression.

For example, subexpressions involved in evaluating default arguments (8.3.6) areconsidered to be created in the expression that calls the function, not the expression that defines the defaultargument. — end note ]12Accessing an object designated by a volatile glvalue (3.10), modifying an object, calling a library I/Ofunction, or calling a function that does any of those operations are all side effects, which are changes in thestate of the execution environment. Evaluation of an expression (or a sub-expression) in general includesboth value computations (including determining the identity of an object for glvalue evaluation and fetchinga value previously assigned to an object for prvalue evaluation) and initiation of side effects.

When a callto a library I/O function returns or an access to a volatile object is evaluated the side effect is considered§ 1.910© ISO/IEC 2011 – All rights reservedISO/IEC 14882:2011(E)complete, even though some external actions implied by the call (such as the I/O itself) or by the volatileaccess may not have completed yet.13Sequenced before is an asymmetric, transitive, pair-wise relation between evaluations executed by a singlethread (1.10), which induces a partial order among those evaluations. Given any two evaluations A and B, ifA is sequenced before B, then the execution of A shall precede the execution of B.

If A is not sequenced beforeB and B is not sequenced before A, then A and B are unsequenced. [ Note: The execution of unsequencedevaluations can overlap. — end note ] Evaluations A and B are indeterminately sequenced when either Ais sequenced before B or B is sequenced before A, but it is unspecified which. [ Note: Indeterminatelysequenced evaluations cannot overlap, but either could be executed first. — end note ]14Every value computation and side effect associated with a full-expression is sequenced before every valuecomputation and side effect associated with the next full-expression to be evaluated.8 .15Except where noted, evaluations of operands of individual operators and of subexpressions of individualexpressions are unsequenced. [ Note: In an expression that is evaluated more than once during the executionof a program, unsequenced and indeterminately sequenced evaluations of its subexpressions need not beperformed consistently in different evaluations.

— end note ] The value computations of the operands of anoperator are sequenced before the value computation of the result of the operator. If a side effect on a scalarobject is unsequenced relative to either anotherside effect on the same scalar object or a value computationusing the value of the same scalar object, the behavior is undefined.[ Example:void f(int, int);void g(int i, int* v) {i = v[i++];// the behavior is undefinedi = 7, i++, i++;// i becomes 9i = i++ + 1;i = i + 1;// the behavior is undefined// the value of i is incrementedf(i = -1, i = -1);// the behavior is undefined}— end example ]When calling a function (whether or not the function is inline), every value computation and side effectassociated with any argument expression, or with the postfix expression designating the called function, issequenced before execution of every expression or statement in the body of the called function.

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