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

Стандарт C++ 11 (1119564), страница 29

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

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

The value is unchanged.2This conversion is called floating point promotion.4.7Integral conversions[conv.integral]1A prvalue of an integer type can be converted to a prvalue of another integer type. A prvalue of an unscopedenumeration type can be converted to a prvalue of an integer type.2If the destination type is unsigned, the resulting value is the least unsigned integer congruent to the sourceinteger (modulo 2n where n is the number of bits used to represent the unsigned type). [ Note: In a two’scomplement representation, this conversion is conceptual and there is no change in the bit pattern (if thereis no truncation). — end note ]3If the destination type is signed, the value is unchanged if it can be represented in the destination type (andbit-field width); otherwise, the value is implementation-defined.4If the destination type is bool, see 4.12.

If the source type is bool, the value false is converted to zero andthe value true is converted to one.5The conversions allowed as integral promotions are excluded from the set of integral conversions.4.81Floating point conversions[conv.double]A prvalue of floating point type can be converted to a prvalue of another floating point type.

If thesource value can be exactly represented in the destination type, the result of the conversion is that exactrepresentation. If the source value is between two adjacent destination values, the result of the conversionis an implementation-defined choice of either of those values. Otherwise, the behavior is undefined.§ 4.884© ISO/IEC 2011 – All rights reservedISO/IEC 14882:2011(E)2The conversions allowed as floating point promotions are excluded from the set of floating point conversions.4.9Floating-integral conversions[conv.fpint]1A prvalue of a floating point type can be converted to a prvalue of an integer type. The conversion truncates; that is, the fractional part is discarded.

The behavior is undefined if the truncated value cannot berepresented in the destination type. [ Note: If the destination type is bool, see 4.12. — end note ]2A prvalue of an integer type or of an unscoped enumeration type can be converted to a prvalue of a floatingpoint type. The result is exact if possible. If the value being converted is in the range of values that canbe represented but the value cannot be represented exactly, it is an implementation-defined choice of eitherthe next lower or higher representable value.

[ Note: Loss of precision occurs if the integral value cannotbe represented exactly as a value of the floating type. — end note ] If the value being converted is outsidethe range of values that can be represented, the behavior is undefined. If the source type is bool, the valuefalse is converted to zero and the value true is converted to one.4.10Pointer conversions[conv.ptr]1A null pointer constant is an integral constant expression (5.19) prvalue of integer type that evaluates tozero or a prvalue of type std::nullptr_t. A null pointer constant can be converted to a pointer type; theresult is the null pointer value of that type and is distinguishable from every other value of object pointer orfunction pointer type.

Such a conversion is called a null pointer conversion. Two null pointer values of thesame type shall compare equal. The conversion of a null pointer constant to a pointer to cv-qualified type isa single conversion, and not the sequence of a pointer conversion followed by a qualification conversion (4.4).A null pointer constant of integral type can be converted to a prvalue of type std::nullptr_t.

[ Note: Theresulting prvalue is not a null pointer value. — end note ]2A prvalue of type “pointer to cv T,” where T is an object type, can be converted to a prvalue of type “pointerto cv void”. The result of converting a “pointer to cv T” to a “pointer to cv void” points to the start ofthe storage location where the object of type T resides, as if the object is a most derived object (1.8) of typeT (that is, not a base class subobject). The null pointer value is converted to the null pointer value of thedestination type.3A prvalue of type “pointer to cv D”, where D is a class type, can be converted to a prvalue of type “pointerto cv B”, where B is a base class (Clause 10) of D.

If B is an inaccessible (Clause 11) or ambiguous (10.2)base class of D, a program that necessitates this conversion is ill-formed. The result of the conversion is apointer to the base class subobject of the derived class object. The null pointer value is converted to thenull pointer value of the destination type.4.11Pointer to member conversions[conv.mem]1A null pointer constant (4.10) can be converted to a pointer to member type; the result is the null memberpointer value of that type and is distinguishable from any pointer to member not created from a null pointerconstant.

Such a conversion is called a null member pointer conversion. Two null member pointer valuesof the same type shall compare equal. The conversion of a null pointer constant to a pointer to member ofcv-qualified type is a single conversion, and not the sequence of a pointer to member conversion followed bya qualification conversion (4.4).2A prvalue of type “pointer to member of B of type cv T”, where B is a class type, can be converted to aprvalue of type “pointer to member of D of type cv T”, where D is a derived class (Clause 10) of B. If B isan inaccessible (Clause 11), ambiguous (10.2), or virtual (10.1) base class of D, or a base class of a virtualbase class of D, a program that necessitates this conversion is ill-formed.

The result of the conversion refersto the same member as the pointer to member before the conversion took place, but it refers to the baseclass member as if it were a member of the derived class. The result refers to the member in D’s instance of§ 4.11© ISO/IEC 2011 – All rights reserved85ISO/IEC 14882:2011(E)B. Since the result has type “pointer to member of D of type cv T”, it can be dereferenced with a D object.The result is the same as if the pointer to member of B were dereferenced with the B subobject of D. Thenull member pointer value is converted to the null member pointer value of the destination type.574.121[conv.bool]A prvalue of arithmetic, unscoped enumeration, pointer, or pointer to member type can be converted to aprvalue of type bool.

A zero value, null pointer value, or null member pointer value is converted to false;any other value is converted to true. A prvalue of type std::nullptr_t can be converted to a prvalue oftype bool; the resulting value is false.4.131Boolean conversionsInteger conversion rank[conv.rank]Every integer type has an integer conversion rank defined as follows:— No two signed integer types other than char and signed char (if char is signed) shall have the samerank, even if they have the same representation.— The rank of a signed integer type shall be greater than the rank of any signed integer type with asmaller size.— The rank of long long int shall be greater than the rank of long int, which shall be greater thanthe rank of int, which shall be greater than the rank of short int, which shall be greater than therank of signed char.— The rank of any unsigned integer type shall equal the rank of the corresponding signed integer type.— The rank of any standard integer type shall be greater than the rank of any extended integer typewith the same size.— The rank of char shall equal the rank of signed char and unsigned char.— The rank of bool shall be less than the rank of all other standard integer types.— The ranks of char16_t, char32_t, and wchar_t shall equal the ranks of their underlying types (3.9.1).— The rank of any extended signed integer type relative to another extended signed integer type withthe same size is implementation-defined, but still subject to the other rules for determining the integerconversion rank.— For all integer types T1, T2, and T3, if T1 has greater rank than T2 and T2 has greater rank than T3,then T1 shall have greater rank than T3.[ Note: The integer conversion rank is used in the definition of the integral promotions (4.5) and the usualarithmetic conversions (Clause 5).

— end note ]57) The rule for conversion of pointers to members (from pointer to member of base to pointer to member of derived) appearsinverted compared to the rule for pointers to objects (from pointer to derived to pointer to base) (4.10, Clause 10). Thisinversion is necessary to ensure type safety. Note that a pointer to member is not an object pointer or a function pointer andthe rules for conversions of such pointers do not apply to pointers to members.

In particular, a pointer to member cannot beconverted to a void*.§ 4.1386© ISO/IEC 2011 – All rights reservedISO/IEC 14882:2011(E)5Expressions[expr]1[ Note: Clause 5 defines the syntax, order of evaluation, and meaning of expressions.58 An expression is asequence of operators and operands that specifies a computation. An expression can result in a value andcan cause side effects. — end note ]2[ Note: Operators can be overloaded, that is, given meaning when applied to expressions of class type (Clause9) or enumeration type (7.2). Uses of overloaded operators are transformed into function calls as describedin 13.5. Overloaded operators obey the rules for syntax specified in Clause 5, but the requirements ofoperand type, value category, and evaluation order are replaced by the rules for function call.

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

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

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

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