Главная » Просмотр файлов » B. Stroustrup - The C++ Programming Language

B. Stroustrup - The C++ Programming Language (794319), страница 4

Файл №794319 B. Stroustrup - The C++ Programming Language (B. Stroustrup - The C++ Programming Language) 4 страницаB. Stroustrup - The C++ Programming Language (794319) страница 42019-05-09СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

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

Give up the game of being always Marcus Cocoza. Youhave worried too much about Marcus Cocoza, so that you have been really his slaveand prisoner. You have not done anything without first considering how it would affectMarcus Cocoza’s happiness and prestige. You were always much afraid that Marcusmight do a stupid thing, or be bored. What would it really have mattered? All over theworld people are doing stupid things ... I should like you to be easy, your little heart tobe light again.

You must from now, be more than one, many people, as many as youcan think of ...’’– Karen Blixen,The Dreamers from Seven Gothic Tales (1934)1Notes to the ReaderHurry Slowly(festina lente).– Octavius, Caesar Augustus••••••The Structure of This BookIntroduction; Basic Facilities; Abstraction Mechanisms; The Standard Library; Examplesand ReferencesThe Design of C++Programming Styles; Type Checking; C Compatibility; Language, Libraries, and SystemsLearning C++Programming in C++; Suggestions for C++ Programmers; Suggestions for C Programmers;Suggestions for Java ProgrammersHistoryTimeline; The Early Years; The 1998 Standard; The 2011 Standard; What is C++ Used for?AdviceReferences1.1 The Structure of This BookA pure tutorial sorts its topics so that no concept is used before it has been introduced; it must beread linearly starting with page one. Conversely, a pure reference manual can be accessed startingat any point; it describes each topic succinctly with references (forward and backward) to relatedtopics.

A pure tutorial can in principle be read without prerequisites – it carefully describes all. Apure reference can be used only by someone familiar with all fundamental concepts and techniques.This book combines aspects of both. If you know most concepts and techniques, you can access iton a per-chapter or even on a per-section basis. If not, you can start at the beginning, but try not toget bogged down in details. Use the index and the cross-references.4Notes to the ReaderChapter 1Making parts of the book relatively self-contained implies some repetition, but repetition alsoserves as review for people reading the book linearly. The book is heavily cross-referenced both toitself and to the ISO C++ standard. Experienced programmers can read the (relatively) quick‘‘tour’’ of C++ to gain the overview needed to use the book as a reference.

This book consists offour parts:Part IIntroduction: Chapter 1 (this chapter) is a guide to this book and provides a bit ofC++ background. Chapters 2-5 give a quick introduction to the C++ languageand its standard library.Part IIBasic Facilities: Chapters 6-15 describe C++’s built-in types and the basic facilities for constructing programs out of them.Part IIIAbstraction Mechanisms: Chapters 16-29 describe C++’s abstraction mechanisms and their use for object-oriented and generic programming.Part IVChapters 30-44 provide an overview of the standard library and a discussion ofcompatibility issues.1.1.1 IntroductionThis chapter, Chapter 1, provides an overview of this book, some hints about how to use it, andsome background information about C++ and its use.

You are encouraged to skim through it, readwhat appears interesting, and return to it after reading other parts of the book. Please do not feelobliged to read it all carefully before proceeding.The following chapters provide an overview of the major concepts and features of the C++ programming language and its standard library:Chapter 2A Tour of C++: The Basics describes C++’s model of memory, computation, anderror handling.Chapter 3A Tour of C++: Abstraction Mechanisms presents the language features supporting data abstraction, object-oriented programming, and generic programming.Chapter 4A Tour of C++: Containers and Algorithms introduces strings, simple I/O, containers, and algorithms as provided by the standard library.Chapter 5A Tour of C++: Concurrency and Utilities outlines the standard-library utilitiesrelated to resource management, concurrency, mathematical computation, regular expressions, and more.This whirlwind tour of C++’s facilities aims to give the reader a taste of what C++ offers.

In particular, it should convince readers that C++ has come a long way since the first, second, and third editions of this book.1.1.2 Basic FacilitiesPart II focuses on the subset of C++ that supports the styles of programming traditionally done in Cand similar languages. It introduces the notions of type, object, scope, and storage. It presents thefundamentals of computation: expressions, statements, and functions.

Modularity – as supportedby namespaces, source files, and exception handling – is also discussed:Chapter 6Types and Declarations: Fundamental types, naming, scopes, initialization, simple type deduction, object lifetimes, and type aliasesSection 1.1.2Basic Facilities5Chapter 7Chapter 8Chapter 9Pointers, Arrays, and ReferencesStructures, Unions, and EnumerationsStatements: Declarations as statements, selection statements (if and switch), iteration statements (for, while, and do), goto, and commentsChapter 10 Expressions: A desk calculator example, survey of operators, constant expressions, and implicit type conversion.Chapter 11 Select Operations: Logical operators, the conditional expression, increment anddecrement, free store (new and delete), {}-lists, lambda expressions, and explicittype conversion (static_cast and const_cast)Chapter 12 Functions: Function declarations and definitions, inline functions, constexprfunctions, argument passing, overloaded functions, pre- and postconditions,pointers to functions, and macrosChapter 13 Exception Handling: Styles of error handling, exception guarantees, resourcemanagement, enforcing invariants, throw and catch, a vector implementationChapter 14 Namespaces: namespace, modularization and interface, composition using namespacesChapter 15 Source Files and Programs: Separate compilation, linkage, using header files,and program start and terminationI assume that you are familiar with most of the programming concepts used in Part I.

For example,I explain the C++ facilities for expressing recursion and iteration, but I do not go into technicaldetails or spend much time explaining how these concepts are useful.The exception to this rule is exceptions. Many programmers lack experience with exceptions orgot their experience from languages (such as Java) where resource management and exception handling are not integrated. Consequently, the chapter on exception handling (Chapter 13) presents thebasic philosophy of C++ exception handling and resource management. It goes into some detailabout strategy with a focus on the ‘‘Resource Acquisition Is Initialization’’ technique (RAII).1.1.3 Abstraction MechanismsPart III describes the C++ facilities supporting various forms of abstraction, including object-oriented and generic programming.

The chapters fall into three rough categories: classes, class hierarchies, and templates.The first four chapters concentrate of the classes themselves:Chapter 16 Classes: The notion of a user-defined type, a class, is the foundation of all C++abstraction mechanisms.Chapter 17 Construction, Cleanup, Copy, and Move shows how a programmer can define themeaning of creation and initialization of objects of a class. Further, the meaningof copy, move, and destruction can be specified.Chapter 18 Operator Overloading presents the rules for giving meaning to operators foruser-defined types with an emphasis on conventional arithmetic and logical operators, such as +, ∗, and &.Chapter 19 Special Operators discusses the use of user-defined operator for non-arithmeticpurposes, such as [] for subscripting, () for function objects, and −> for ‘‘smartpointers.’’6Notes to the ReaderChapter 1Classes can be organized into hierarchies:Chapter 20 Derived Classes presents the basic language facilities for building hierarchies outof classes and the fundamental ways of using them.

We can provide completeseparation between an interface (an abstract class) and its implementations(derived classes); the connection between them is provided by virtual functions.The C++ model for access control (public, protected, and private) is presented.Chapter 21 Class Hierarchies discusses ways of using class hierarchies effectively. It alsopresents the notion of multiple inheritance, that is, a class having more than onedirect base class.Chapter 22 Run-Time Type Information presents ways to navigate class hierarchies usingdata stored in objects. We can use dynamic_cast to inquire whether an object ofa base class was defined as an object of a derived class and use the typeid to gainminimal information from an object (such as the name of its class).Many of the most flexible, efficient, and useful abstractions involve the parameterization of types(classes) and algorithms (functions) with other types and algorithms:Chapter 23 Templates presents the basic principles behind templates and their use.

Classtemplates, function templates, and template aliases are presented.Chapter 24 Generic Programming introduces the basic techniques for designing generic programs. The technique of lifting an abstract algorithm from a number of concretecode examples is central, as is the notion of concepts specifying a generic algorithm’s requirements on its arguments.Chapter 25 Specialization describes how templates are used to generate classes and functions, specializations, given a set of template arguments.Chapter 26 Instantiation focuses on the rules for name binding.Chapter 27 Templates and Hierarchies explains how templates and class hierarchies can beused in combination.Chapter 28 Metaprogramming explores how templates can be used to generate programs.Templates provide a Turing-complete mechanism for generating code.Chapter 29 A Matrix Design gives a longish example to show how language features can beused in combination to solve a complex design problem: the design of an Ndimensional matrix with near-arbitrary element types.The language features supporting abstraction techniques are described in the context of those techniques.

The presentation technique in Part III differs from that of Part II in that I don’t assume thatthe reader knows the techniques described.1.1.4 The Standard LibraryThe library chapters are less tutorial than the language chapters. In particular, they are meant to beread in any order and can be used as a user-level manual for the library components:Chapter 30 Standard-Library Overview gives an overview of the standard library, lists thestandard-library headers, and presents language support and diagnostics support,such as exception and system_error.Chapter 31 STL Containers presents the containers from the iterators, containers, and algorithms framework (called the STL), including vector, map, and unordered_set.Section 1.1.4Chapter 32Chapter 33Chapter 34Chapter 35Chapter 36Chapter 37Chapter 38Chapter 39Chapter 40Chapter 41Chapter 42Chapter 43Chapter 44The Standard Library7STL Algorithms presents the algorithms from the STL, including find(), sort(),and merge().STL Iterators presents iterators and other utilities from the STL, includingreverse_iterator, move_iterator, and function.Memory and Resources presents utility components related to memory andresource management, such as array, bitset, pair, tuple, unique_ptr, shared_ptr,allocators, and the garbage collector interface.Utilities presents minor utility components, such as time utilities, type traits, andvarious type functions.Strings documents the string library, including the character traits that are thebasis for the use of different character sets.Regular Expressions describes the regular expression syntax and the variousways of using it for string matching, including regex_match() for matching acomplete string, regex_search() for finding a pattern in a string, regex_replace()for simple replacement, and regex_iterator for general traversal of a stream ofcharacters.I/O Streams documents the stream I/O library.

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

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

Список файлов книги

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