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

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

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

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

Table 7 summarizes the valid combinations of simple-type-specifiers and the types they specify.108© ISO/IECISO/IEC 14882:1998(E)7 Declarations7.1.5.2 Simple type specifiersTable 7—simple-type-specifiers and the types they specify__________________________________________________ Specifier(s) Type____________________________________________________________________________________________________ type-name the type named char “char” unsigned char “unsigned char” signed char “signed char” bool “bool” unsigned “unsigned int” unsigned int “unsigned int” signed “int” signed int “int” int “int” unsigned short int  “unsigned short int”  unsigned short “unsigned short int”  unsigned long int  “unsigned long int”  unsigned long “unsigned long int”  signed long int “long int” signed long “long int” long int “long int” long “long int” signed short int “short int” signed short “short int” short int “short int” short “short int” wchar_t “wchar_t” float “float” double “double” long double “long double” void__________________________________________________ “void”When multiple simple-type-specifiers are allowed, they can be freely intermixed with other decl-specifiersin any order.

It is implementation-defined whether bit-fields and objects of char type are represented assigned or unsigned quantities. The signed specifier forces char objects and bit-fields to be signed; it isredundant with other integral types.7.1.5.3 Elaborated type specifiers[dcl.type.elab]elaborated-type-specifier:class-key ::opt nested-name-specifieropt identifierenum ::opt nested-name-specifieropt identifiertypename ::opt nested-name-specifier identifiertypename ::opt nested-name-specifier templateopt template-id1If an elaborated-type-specifier is the sole constituent of a declaration, the declaration is ill-formed unless itis an explicit specialization (14.7.3), an explicit instantiation (14.7.2) or it has one of the following forms:class-keyfriendfriendfriend2identifierclass-keyclass-keyclass-key;identifier ;::identifier ;nested-name-specifier identifier ;3.4.4 describes how name lookup proceeds for the identifier in an elaborated-type-specifier.

If theidentifier resolves to a class-name or enum-name, the elaborated-type-specifier introduces it into the declaration the same way a simple-type-specifier introduces its type-name. If the identifier resolves to a typedef-109ISO/IEC 14882:1998(E)7.1.5.3 Elaborated type specifiers© ISO/IEC7 Declarationsname or a template type-parameter, the elaborated-type-specifier is ill-formed. [Note: this implies that,within a class template with a template type-parameter T, the declarationfriend class T;is ill-formed. ] If name lookup does not find a declaration for the name, the elaborated-type-specifier isill-formed unless it is of the simple form class-key identifier in which case the identifier is declared asdescribed in 3.3.1.3The class-key or enum keyword present in the elaborated-type-specifier shall agree in kind with the declaration to which the name in the elaborated-type-specifier refers.

This rule also applies to the form ofelaborated-type-specifier that declares a class-name or friend class since it can be construed as referringto the definition of the class. Thus, in any elaborated-type-specifier, the enum keyword shall be used torefer to an enumeration (7.2), the union class-key shall be used to refer to a union (clause 9), and eitherthe class or struct class-key shall be used to refer to a class (clause 9) declared using the class orstruct class-key.7.2 Enumeration declarations1[dcl.enum]An enumeration is a distinct type (3.9.1) with named constants.

Its name becomes an enum-name, withinits scope.enum-name:identifierenum-specifier:enum identifieropt { enumerator-listopt }enumerator-list:enumerator-definitionenumerator-list , enumerator-definitionenumerator-definition:enumeratorenumerator = constant-expressionenumerator:identifierThe identifiers in an enumerator-list are declared as constants, and can appear wherever constants arerequired.

An enumerator-definition with = gives the associated enumerator the value indicated by theconstant-expression. The constant-expression shall be of integral or enumeration type. If the firstenumerator has no initializer, the value of the corresponding constant is zero. An enumerator-definitionwithout an initializer gives the enumerator the value obtained by increasing the value of the previousenumerator by one.2[Example:enum { a, b, c=0 };enum { d, e, f=e+2 };defines a, c, and d to be zero, b and e to be 1, and f to be 3.

]3The point of declaration for an enumerator is immediately after its enumerator-definition. [Example:const int x = 12;{ enum { x = x }; }Here, the enumerator x is initialized with the value of the constant x, namely 12. ]4Each enumeration defines a type that is different from all other types. Following the closing brace of anenum-specifier, each enumerator has the type of its enumeration. Prior to the closing brace, the type ofeach enumerator is the type of its initializing value. If an initializer is specified for an enumerator, the110© ISO/IECISO/IEC 14882:1998(E)7 Declarations7.2 Enumeration declarationsinitializing value has the same type as the expression.

If no initializer is specified for the first enumerator,the type is an unspecified integral type. Otherwise the type is the same as the type of the initializing valueof the preceding enumerator unless the incremented value is not representable in that type, in which casethe type is an unspecified integral type sufficient to contain the incremented value.5The underlying type of an enumeration is an integral type that can represent all the enumerator valuesdefined in the enumeration. It is implementation-defined which integral type is used as the underlying typefor an enumeration except that the underlying type shall not be larger than int unless the value of an enumerator cannot fit in an int or unsigned int. If the enumerator-list is empty, the underlying type isas if the enumeration had a single enumerator with value 0. The value of sizeof() applied to an enumeration type, an object of enumeration type, or an enumerator, is the value of sizeof() applied to theunderlying type.6For an enumeration where e min is the smallest enumerator and e max is the largest, the values of the enumeration are the values of the underlying type in the range b min to b max , where b min and b max are, respectively,the smallest and largest values of the smallest bit-field that can store e min and e max .81) It is possible todefine an enumeration that has values not defined by any of its enumerators.7Two enumeration types are layout-compatible if they have the same underlying type.8The value of an enumerator or an object of an enumeration type is converted to an integer by integral promotion (4.5).

[Example:enum color { red, yellow, green=20, blue };color col = red;color* cp = &col;if (*cp == blue)// ...makes color a type describing various colors, and then declares col as an object of that type, and cp as apointer to an object of that type. The possible values of an object of type color are red, yellow,green, blue; these values can be converted to the integral values 0, 1, 20, and 21. Since enumerationsare distinct types, objects of type color can be assigned only values of type color.color c = 1;// error: type mismatch,// no conversion from int to colorint i = yellow;// OK: yellow converted to integral value 1// integral promotion—end example]9An expression of arithmetic or enumeration type can be converted to an enumeration type explicitly.

Thevalue is unchanged if it is in the range of enumeration values of the enumeration type; otherwise the resulting enumeration value is unspecified.10The enum-name and each enumerator declared by an enum-specifier is declared in the scope that immediately contains the enum-specifier. These names obey the scope rules defined for all names in (3.3) and(3.4). An enumerator declared in class scope can be referred to using the class member access operators(::, .

(dot) and -> (arrow)), see 5.2.5. [Example:class X {public:enum direction { left=’l’, right=’r’ };int f(int i){ return i==left ? 0 : i==right ? 1 : 2; }};__________________81) On a two’s-complement machine, bmax is the smallest value greater than or equal to max (abs(e min ) − 1 ,abs(e max ) ) of the form2 M − 1; b min is zero if e min is non-negative and − (b max + 1 ) otherwise.111ISO/IEC 14882:1998(E)© ISO/IEC7.2 Enumeration declarationsvoid g(X* p){direction d;int i;i = p->f(left);i = p->f(X::right);i = p->f(p->left);// ...}7 Declarations// error: direction not in scope// error: left not in scope// OK// OK—end example]7.3 Namespaces[basic.namespace]1A namespace is an optionally-named declarative region.

The name of a namespace can be used to accessentities declared in that namespace; that is, the members of the namespace. Unlike other declarativeregions, the definition of a namespace can be split over several parts of one or more translation units.2A name declared outside all named namespaces, blocks (6.3) and classes (clause 9) has global namespacescope (3.3.5).7.3.1 Namespace definition1[namespace.def]The grammar for a namespace-definition isnamespace-name:original-namespace-namenamespace-aliasoriginal-namespace-name:identifiernamespace-definition:named-namespace-definitionunnamed-namespace-definitionnamed-namespace-definition:original-namespace-definitionextension-namespace-definitionoriginal-namespace-definition:namespace identifier { namespace-body }extension-namespace-definition:namespace original-namespace-name { namespace-body }unnamed-namespace-definition:namespace { namespace-body }namespace-body:declaration-seqopt2The identifier in an original-namespace-definition shall not have been previously defined in the declarativeregion in which the original-namespace-definition appears.

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

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

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

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