整理网上的基本常见知识点。
1
对于C++中的类,结构体,共用体等具有成员函数或变量的数据类型(对象)时,如果存在对象a,而对象中有成员b,那么可以使用a.b的方式,使用对应的成员。
如果存在变量p,指向a, 即p = &a, 这时可以用p->b来使用成员b。
即,->操作符是用于带成员的类型对应指针上,用来提取成员变量或函数用的。
p->b等同于(*p).b。
对于任意的对象a,写作(&a)->b也是可以的,不过很少有这样写。
2
::的作用
- A::member就表示类A中的成员member 作用域符号
- 局作用域符号:当全局变量在局部函数中与其中某个变量重名,那么就可以用::来区分如:
char var; //全局变量
void sleep()
{
char var; //局部变量
var(局部变量) = var(局部变量) *var(局部变量) ;
::var(全局变量) =::var(全局变量) *char(局部变量);
}
3
include <> 到标准函数库中寻找文件
include “” 从当前目录寻找文件
4
gcc g++ 编译原理
When you invoke GCC, it normally does preprocessing, compilation,
assembly and linking. The "overall options" allow you to stop this
process at an intermediate stage. For example, the -c option says not
to run the linker. Then the output consists of object files output by
the assembler.
Other options are passed on to one or more stages of processing. Some
options control the preprocessor and others the compiler itself. Yet
other options control the assembler and linker; most of these are not
documented here, since you rarely need to use any of them.
Most of the command-line options that you can use with GCC are useful
for C programs; when an option is only useful with another language
(usually C++), the explanation says so explicitly. If the description
for a particular option does not mention a source language, you can use
that option with all supported languages.
11万+

被折叠的 条评论
为什么被折叠?



