I. Possible combinations:
(1) const char * P
(2) Char const * P
(3) char * const P(4) const char ** P
(5) Char const ** P
(6) char * const * P
(7) Char ** const P
Of course, there are several cases of inserting a const in (5), (6), and
Use const whenever possible
One wonderful thing about const is that it allows you to specify a semantic constraint: a specific object should not be modified. The compiler will execute this constraint. It allows you to notify the compiler and other
Item 3: Use const whenever possible
By Scott Meyers
Translator: fatalerror99 (itepub's nirvana)
Release: http://blog.csdn.net/fatalerror99/
One wonderful thing about const is that it allows you to specify a semantic (semantic) Constraint: a specific
Const, static, extern usage summary, constextern
Const application:
1. For the basic declaration const int r = 100; // standard const variable declaration and initialization, the compiler will directly replace it with 100 during compilation after
Overview:The source code of the C preprocessor handler, which runs before the compiler, usually begins with the symbol #.Also involves static, const knowledge points ... Some are similar to Java ... Some easily confuse t.t.Many of the chapters in
C + + keyword Static,register,const,volatile,extern
Static variables are scoped to a file, space is allocated at the beginning of the program, Space is freed at the end, default is initialized to 0, and its value can be changed when used.
The const in C + + can be used to modify variables, functions, and have different meanings in different places, as summarized below.
The semantics of the const
The purpose of const in C + + is to guarantee the constant nature of objects through
I. Static: static is a common modifier in C ++. It is used to control the storage and visibility of variables, next I will talk about the reason and role of the static modifier, and fully analyze the essence of the static modifier.
Static:
1.
Objective
This article mainly describes how to use CONST,STATIC,EXTERN3 in the development of keywords, if you like my article, you can pay attention to my microblog: Acridine a Zheng, you can also come to small code brother, understand our iOS
Const, static, extern introduction, constexternConst, static, extern Introduction 1. Difference Between const and macro:
Const Introduction: the commonly used string constants are generally extracted into macros, but apple does not recommend that
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.