Главная » Просмотр файлов » Стандарт C++ 98

Стандарт C++ 98 (1119566), страница 28

Файл №1119566 Стандарт C++ 98 (Стандарт C++ 98) 28 страницаСтандарт C++ 98 (1119566) страница 282019-05-09СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

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

In suchcases, even if there is a inheritance relationship between the source and destination classes, whether thestatic_cast or reinterpret_cast interpretation is used is unspecified.7In addition to those conversions, the following static_cast and reinterpret_cast operations(optionally followed by a const_cast operation) may be performed using the cast notation of explicittype conversion, even if the base class type is not accessible:— a pointer to an object of derived class type or an lvalue of derived class type may be explicitly convertedto a pointer or reference to an unambiguous base class type, respectively;— a pointer to member of derived class type may be explicitly converted to a pointer to member of anunambiguous non-virtual base class type;82© ISO/IECISO/IEC 14882:1998(E)5 Expressions5.4 Explicit type conversion (cast notation)— a pointer to an object of non-virtual base class type, an lvalue of non-virtual base class type, or a pointerto member of non-virtual base class type may be explicitly converted to a pointer, a reference, or apointer to member of a derived class type, respectively.5.5 Pointer-to-member operators1[expr.mptr.oper]The pointer-to-member operators ->* and .* group left-to-right.pm-expression:cast-expressionpm-expression .* cast-expressionpm-expression ->* cast-expression2The binary operator .* binds its second operand, which shall be of type “pointer to member of T” (whereT is a completely-defined class type) to its first operand, which shall be of class T or of a class of which Tis an unambiguous and accessible base class.

The result is an object or a function of the type specified bythe second operand.3The binary operator ->* binds its second operand, which shall be of type “pointer to member of T” (whereT is a completely-defined class type) to its first operand, which shall be of type “pointer to T” or “pointer toa class of which T is an unambiguous and accessible base class.” The result is an object or a function of thetype specified by the second operand.4If the dynamic type of the object does not contain the member to which the pointer refers, the behavior isundefined.5The restrictions on cv-qualification, and the manner in which the cv-qualifiers of the operands are combinedto produce the cv-qualifiers of the result, are the same as the rules for E1.E2 given in 5.2.5.

[Note: it is notpossible to use a pointer to member that refers to a mutable member to modify a const class object.For example,struct S {mutable int i;};const S cs;int S::* pm = &S::i;cs.*pm = 88;// pm refers to mutable member S::i// ill-formed: cs is a const object]6If the result of .* or ->* is a function, then that result can be used only as the operand for the functioncall operator (). [Example:(ptr_to_obj->*ptr_to_mfct)(10);calls the member function denoted by ptr_to_mfct for the object pointed to by ptr_to_obj. ] Theresult of a .* expression is an lvalue only if its first operand is an lvalue and its second operand is apointer to data member.

The result of an ->* expression is an lvalue only if its second operand is a pointerto data member. If the second operand is the null pointer to member value (4.11), the behavior is undefined.5.6 Multiplicative operators1[expr.mul]The multiplicative operators *, /, and % group left-to-right.multiplicative-expression:pm-expressionmultiplicative-expression * pm-expressionmultiplicative-expression / pm-expressionmultiplicative-expression % pm-expression83ISO/IEC 14882:1998(E)5.6 Multiplicative operators© ISO/IEC5 Expressions2The operands of * and / shall have arithmetic or enumeration type; the operands of % shall have integral orenumeration type. The usual arithmetic conversions are performed on the operands and determine the typeof the result.3The binary * operator indicates multiplication.4The binary / operator yields the quotient, and the binary % operator yields the remainder from the divisionof the first expression by the second.

If the second operand of / or % is zero the behavior is undefined; otherwise (a/b)*b + a%b is equal to a. If both operands are nonnegative then the remainder is nonnegative; if not, the sign of the remainder is implementation-defined74).5.7 Additive operators1[expr.add]The additive operators + and - group left-to-right. The usual arithmetic conversions are performed foroperands of arithmetic or enumeration type.additive-expression:multiplicative-expressionadditive-expression + multiplicative-expressionadditive-expression - multiplicative-expressionFor addition, either both operands shall have arithmetic or enumeration type, or one operand shall be apointer to a completely defined object type and the other shall have integral or enumeration type.2For subtraction, one of the following shall hold:— both operands have arithmetic or enumeration type; or— both operands are pointers to cv-qualified or cv-unqualified versions of the same completely definedobject type; or— the left operand is a pointer to a completely defined object type and the right operand has integral orenumeration type.3The result of the binary + operator is the sum of the operands.

The result of the binary - operator is the difference resulting from the subtraction of the second operand from the first.4For the purposes of these operators, a pointer to a nonarray object behaves the same as a pointer to the firstelement of an array of length one with the type of the object as its element type.5When an expression that has integral type is added to or subtracted from a pointer, the result has the type ofthe pointer operand. If the pointer operand points to an element of an array object, and the array is largeenough, the result points to an element offset from the original element such that the difference of the subscripts of the resulting and original array elements equals the integral expression. In other words, if theexpression P points to the i-th element of an array object, the expressions (P)+N (equivalently, N+(P))and (P)-N (where N has the value n) point to, respectively, the i+n-th and i– n-th elements of the arrayobject, provided they exist.

Moreover, if the expression P points to the last element of an array object, theexpression (P)+1 points one past the last element of the array object, and if the expression Q points onepast the last element of an array object, the expression (Q)-1 points to the last element of the array object.If both the pointer operand and the result point to elements of the same array object, or one past the last element of the array object, the evaluation shall not produce an overflow; otherwise, the behavior is undefined.6When two pointers to elements of the same array object are subtracted, the result is the difference of thesubscripts of the two array elements.

The type of the result is an implementation-defined signed integraltype; this type shall be the same type that is defined as ptrdiff_t in the <cstddef> header (18.1). Aswith any other arithmetic overflow, if the result does not fit in the space provided, the behavior is undefined. In other words, if the expressions P and Q point to, respectively, the i-th and j-th elements of anarray object, the expression (P)-(Q) has the value i– j provided the value fits in an object of type__________________74) According to work underway toward the revision of ISO C, the preferred algorithm for integer division follows the rules defined inthe ISO Fortran standard, ISO/IEC 1539:1991, in which the quotient is always rounded toward zero.84© ISO/IECISO/IEC 14882:1998(E)5 Expressions5.7 Additive operatorsptrdiff_t. Moreover, if the expression P points either to an element of an array object or one past thelast element of an array object, and the expression Q points to the last element of the same array object, theexpression ((Q)+1)-(P) has the same value as ((Q)-(P))+1 and as -((P)-((Q)+1)), and hasthe value zero if the expression P points one past the last element of the array object, even though theexpression (Q)+1 does not point to an element of the array object.

Unless both pointers point to elementsof the same array object, or one past the last element of the array object, the behavior is undefined.75)8If the value 0 is added to or subtracted from a pointer value, the result compares equal to the originalpointer value. If two pointers point to the same object or function or both point one past the end of thesame array or both are null, and the two pointers are subtracted, the result compares equal to the value 0converted to the type ptrdiff_t.5.8 Shift operators1[expr.shift]The shift operators << and >> group left-to-right.shift-expression:additive-expressionshift-expression << additive-expressionshift-expression >> additive-expressionThe operands shall be of integral or enumeration type and integral promotions are performed.

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

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

Список файлов учебной работы

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