some sentenses from The c++ programming language chapter9

原创 2006年06月18日 16:06:00

Where the unit of compilation is a file, all of a file must be recompiled
whenever a change (however small) has been made to it or to something on which it depends.

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

Note that a
variable 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 (§9.2.3) – in
every 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 explicit declaration.

An unnamed namespace (§8.2.5) can be used to make names local to a compilation unit.

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

A given class, enumeration, and template, etc., must be defined exactly once in a program.
#ifndef CALC_  ERROR_  H
#define CALC_  ERROR_  H
namespace Error {
/ / ...
}
#endif / / CALC_ERROR_H

a variable defined outside any function (that is, global, namespace, and class static
variables) is initialized before main() is invoked.

There is no guaranteed order of initialization of global variables in different translation units.

it is not possible to catch an exception thrown by the initializer
of a global variable

Often, a function returning a reference is a good alternative to a global variable.

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

The C Programming Language——Exercise solutions of the chapter one (1st)

Recently,I have been reading the book The C Progrmming Lanuage(2nd Edition),which written by Dennis ...

OpenGL ES2.0 Programming Guide - chapter 5:OpenGL ES Shading Language

Chapter 5:OpenGL ES Shading Language OpenGL ES Shading Language Basics Variables and Variable Types ...

The Ruby Programming Language【chapter 1读书摘要】

#a sudoku solver in Ruby module Sudoku class Puzzle ASCII=".123456789" BIN="\000\001\002\003\004\005...

The Swift Programming Language - (9)- 类和结构体

类和结构体在swift中类和结构体很相似,可以使用相同的语法规则为类和结构体定义属性(常量或变量)和添加方法,从而扩展类和结构体的功能。 在swift中不需要为自定义类和结构体创建独立的接口和实现文...

基本语言细节--《The C++ Programming Language 》--(1)开辟鸿蒙

基本语言细节--《The C++ Programming Language 》--(1)开辟鸿蒙 1.语言磨砺了我们思维的方式,也决定着我们思考的范围。--B.L.Whort; 2.C++能干什么?...

The C++ Programming Language 第15章课后习题第三题

1.Board.h 2.Board.cpp 3.BoardTextView.h 4.BoardTextV
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)