1, A string literal is a static constant. (It helps the optimizations)
2, Whether two identical string literals are allocated as one is implementation-defined.
3, A character pointer cann't be assigned to a character array.
e.g. char v[] = "Hello, world!";
char *p = "Hi, Jim";
p = v; //OK. implicit conversion of char[] to char*
v = p; //error: cannot assign to array. v is the address of the array, it's not a variable.
4, The compiler will concatenate adjacent strings.
e.g. char alpha[] = "abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
5, A string with prefix L, such as L"angst", is a string of wide characters. Its type is const wchar_t[].
6, A constant must be initialized because it cann't be assigned to.
7, A constant can be evalued at compile time, and if the compiler knows every use of the constant,
it need not allocate space to hold it.
8, A refrence is a name for an object, we must initialize the refrence. The value of a refrence cannot be changed after
initialization. It always refers to the object it was initialzied to denote. In some cases, the compiler cam optimize
away a reference so that there is no object representing that reference at run-time.
9, The initializer for a "pain" T& must be an lvalue(an object whose address you can take) of type T.
The initialzer for a const T& need not be an lvalue or even of type T.
10, The size of an object of a structure type is not necessarily the sum of the size of its members.
This is because many machines require objects of certain types to be allocated on architecture-dependent
boundaries or handle such objects much more efficiently if they are.
11, The name of a structure type can be used before the type is defined as long as that use does not require the name of
a memeber or the size of the structure to be known.
12, An object must be defined exactly once in a program. It may be declared many times but the types must agree exactly.
13, A name that can be used in translation units different from the onw in which it was defined is said to have external linkage.
A name that can be referred to only in the translation unit in which it is defined is said to have internal linkage.
More details, please refer to Section 9.2.
相关文章: