Some Sentences from the C ++ Programming Language Chapter 9

xiaoxiao2021-03-30  216

WHERE The Unit of Compilation IS A File, All of a File Must Be Recompiledwhenever a change (However small) HAS BEEN MADE TO IT or To Something On Which It Dends.

The keyword extern indicatesthat the declaration of x in file2.c is (just) a declaration and not a definition (§4.9). Had xbeen initialized, extern would simply be ignored because a declaration with an initializer is alwaysa definition.

Note that avariable defined without an initializer in the global or a namespace scope is initialized by default.This is not the case for local variables (§4.9.5, §10.4.2) or objects created on the free store

An Inline Function (7.1.1, §10.2.9) Must Be defined - by Identical Definitions - INEVERY TRANSLATION UNIT IN WHICH IT IS USED.

By Default, Consts (§ 5.4) and typedefs (4.9.7) Have Internal Linkage.a const can be given external linkage by an expectit decaration.

An Unnamed Namespace (§8.2.5) can be used to make names local to a compiration unit.

#include / / from standard include directory # include "myheader.h" / / from current directoryUnfortunately, spaces are significant within the <> or "" of an include directive: #include / / will not find < iostream>

A Given Class, ENUMERATION, AND TEMPLATE, ETC., Must Be Defined Exactly Once in a program # i # d r_ hnamespace error {/ / ...} # endif / / Calc_ERROR_H

a variable defined Outside Any Function (That IS, Global, Namespace, And Class StaticVariables) is initialized before main () is invoked.

There is no guaranteed Order of Initialization of Global Variables in diffreent translation units.

IT IS Not Possible To Catch An Exception Thrown By The Initializerof A Global VariableOften, a good alternative to a global variable.

转载请注明原文地址:https://www.9cbs.com/read-130538.html

New Post(0)