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

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

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

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

If this name lookup finds a typedef-name, theelaborated-type-specifier is ill-formed. If this name lookup does not find a previously declared class-nameor enum-name, the elaborated-type-specifier is ill-formed. [Example:struct Node {struct Node* Next;struct Data* Data;// OK: Refers to Node at global scope// OK: Declares type Data// at global scope and member Data};struct Data {struct Node* Node;friend struct ::Glob;friend struct Glob;// OK: Refers to Node at global scope// error: Glob is not declared// cannot introduce a qualified type (7.1.5.3)// OK: Refers to (as yet) undeclared Glob// at global scope./* ... */};struct Base {structstructstructfriendfriendstructstruct};structstructstructstructstructData;::Data*thatData;Base::Data* thisData;class ::Data;class Data;Data { /* ...

*/ };Data;Data;::Data;Base::Data;Base::Datum;Base::Data* pBase;// OK: Declares nested Data// OK: Refers to ::Data// OK: Refers to nested Data// OK: global Data is a friend// OK: nested Data is a friend// Defines nested Data// OK: Redeclares nested Data// OK: Redeclares Data at global scope// error: cannot introduce a qualified type (7.1.5.3)// error: cannot introduce a qualified type (7.1.5.3)// error: Datum undefined// OK: refers to nested Data—end example]3.4.5 Class member access1[basic.lookup.classref]In a class member access expression (5.2.5), if the .

or -> token is immediately followed by an identifierfollowed by a <, the identifier must be looked up to determine whether the < is the beginning of a templateargument list (14.2) or a less-than operator. The identifier is first looked up in the class of the objectexpression. If the identifier is not found, it is then looked up in the context of the entire postfix-expressionand shall name a class or function template.

If the lookup in the class of the object expression finds a template, the name is also looked up in the context of the entire postfix-expression and— if the name is not found, the name found in the class of the object expression is used, otherwise— if the name is found in the context of the entire postfix-expression and does not name a class template,the name found in the class of the object expression is used, otherwise— if the name found is a class template, it must refer to the same entity as the one found in the class of theobject expression, otherwise the program is ill-formed.39ISO/IEC 14882:1998(E)© ISO/IEC3.4.5 Class member access3 Basic concepts2If the id-expression in a class member access (5.2.5) is an unqualified-id, and the type of the object expression is of a class type C (or of pointer to a class type C), the unqualified-id is looked up in the scope of classC.

If the type of the object expression is of pointer to scalar type, the unqualified-id is looked up in the context of the complete postfix-expression.3If the unqualified-id is ˜type-name, and the type of the object expression is of a class type C (or of pointer toa class type C), the type-name is looked up in the context of the entire postfix-expression and in the scope ofclass C. The type-name shall refer to a class-name.

If type-name is found in both contexts, the name shallrefer to the same class type. If the type of the object expression is of scalar type, the type-name is lookedup in the scope of the complete postfix-expression.4If the id-expression in a class member access is a qualified-id of the formclass-name-or-namespace-name::...the class-name-or-namespace-name following the . or -> operator is looked up both in the context of theentire postfix-expression and in the scope of the class of the object expression. If the name is found only inthe scope of the class of the object expression, the name shall refer to a class-name.

If the name is foundonly in the context of the entire postfix-expression, the name shall refer to a class-name or namespacename. If the name is found in both contexts, the class-name-or-namespace-name shall refer to the sameentity. [Note: the result of looking up the class-name-or-namespace-name is not required to be a uniquebase class of the class type of the object expression, as long as the entity or entities named by the qualifiedid are members of the class type of the object expression and are not ambiguous according to 10.2.struct A {int a;};struct B: virtual A { };struct C: B { };struct D: B { };struct E: public C, public D { };struct F: public A { };void f() {E e;e.B::a = 0;F f;f.A::a = 1;// OK, only one A::a in E// OK, A::a is a member of F}—end note]5If the qualified-id has the form::class-name-or-namespace-name::...the class-name-or-namespace-name is looked up in global scope as a class-name or namespace-name.6If the nested-name-specifier contains a class template-id (14.2), its template-arguments are evaluated in thecontext in which the entire postfix-expression occurs.7If the id-expression is a conversion-function-id, its conversion-type-id shall denote the same type in boththe context in which the entire postfix-expression occurs and in the context of the class of the object expression (or the class pointed to by the pointer expression).3.4.6 Using-directives and namespace aliases1[basic.lookup.udir]When looking up a namespace-name in a using-directive or namespace-alias-definition, only namespacenames are considered.40© ISO/IEC3 Basic conceptsISO/IEC 14882:1998(E)3.5 Program and linkage3.5 Program and linkage1[basic.link]A program consists of one or more translation units (clause 2) linked together.

A translation unit consistsof a sequence of declarations.translation-unit:declaration-seqopt2A name is said to have linkage when it might denote the same object, reference, function, type, template,namespace or value as a name introduced by a declaration in another scope:— When a name has external linkage, the entity it denotes can be referred to by names from scopes ofother translation units or from other scopes of the same translation unit.— When a name has internal linkage, the entity it denotes can be referred to by names from other scopes inthe same translation unit.— When a name has no linkage, the entity it denotes cannot be referred to by names from other scopes.3A name having namespace scope (3.3.5) has internal linkage if it is the name of— an object, reference, function or function template that is explicitly declared static or,— an object or reference that is explicitly declared const and neither explicitly declared extern norpreviously declared to have external linkage; or— a data member of an anonymous union.4A name having namespace scope has external linkage if it is the name of— an object or reference, unless it has internal linkage; or— a function, unless it has internal linkage; or— a named class (clause 9), or an unnamed class defined in a typedef declaration in which the class has thetypedef name for linkage purposes (7.1.3); or— a named enumeration (7.2), or an unnamed enumeration defined in a typedef declaration in which theenumeration has the typedef name for linkage purposes (7.1.3); or— an enumerator belonging to an enumeration with external linkage; or— a template, unless it is a function template that has internal linkage (clause 14); or— a namespace (7.3), unless it is declared within an unnamed namespace.5In addition, a member function, static data member, class or enumeration of class scope has external linkage if the name of the class has external linkage.6The name of a function declared in block scope, and the name of an object declared by a block scopeextern declaration, have linkage.

If there is a visible declaration of an entity with linkage having thesame name and type, ignoring entities declared outside the innermost enclosing namespace scope, the blockscope declaration declares that same entity and receives the linkage of the previous declaration. If there ismore than one such matching entity, the program is ill-formed. Otherwise, if no matching entity is found,the block scope entity receives external linkage.41ISO/IEC 14882:1998(E)© ISO/IEC3.5 Program and linkage3 Basic concepts[Example:static void f();static int i = 0;void g() {extern void f();int i;{extern void f();extern int i;}}//1// internal linkage//2: i has no linkage// internal linkage//3: external linkageThere are three objects named i in this program. The object with internal linkage introduced by the declaration in global scope (line //1), the object with automatic storage duration and no linkage introduced bythe declaration on line //2, and the object with static storage duration and external linkage introduced bythe declaration on line //3.

]7When a block scope declaration of an entity with linkage is not found to refer to some other declaration,then that entity is a member of the innermost enclosing namespace. However such a declaration does notintroduce the member name in its namespace scope. [Example:namespace X {void p(){q();extern void q();}void middle(){q();}void q() { /* ... */ }// error: q not yet declared// q is a member of namespace X// error: q not yet declared// definition of X::q}void q() { /* ... */ }// some other, unrelated q—end example]8Names not covered by these rules have no linkage. Moreover, except as noted, a name declared in a localscope (3.3.2) has no linkage.

A name with no linkage (notably, the name of a class or enumeration declaredin a local scope (3.3.2)) shall not be used to declare an entity with linkage. If a declaration uses a typedefname, it is the linkage of the type name to which the typedef refers that is considered. [Example:void f(){struct A { int x; };extern A a;typedef A B;extern B b;}// no linkage// ill-formed// ill-formed—end example] This implies that names with no linkage cannot be used as template arguments (14.3).9Two names that are the same (clause 3) and that are declared in different scopes shall denote the sameobject, reference, function, type, enumerator, template or namespace if— both names have external linkage or else both names have internal linkage and are declared in the sametranslation unit; and— both names refer to members of the same namespace or to members, not by inheritance, of the sameclass; and42© ISO/IECISO/IEC 14882:1998(E)3 Basic concepts3.5 Program and linkage— when both names denote functions, the function types are identical for purposes of overloading; and— when both names denote function templates, the signatures (14.5.5.1) are the same.10After all adjustments of types (during which typedefs (7.1.3) are replaced by their definitions), the typesspecified by all declarations referring to a given object or function shall be identical, except that declarations for an array object can specify array types that differ by the presence or absence of a major arraybound (8.3.4).

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

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

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

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