The C in C++
1 unnamed arguments in the argument list of the function definition (Page 114)
In c++, an argument may be unnamed in the argument list of the function definition. Since it is unnamed , you cannot use it in the function body, of course. Unnamed arguments are allowed to give the programmer a way to "reserve space in the argument list." Whoever uses the function must still call the function with the proper arguments. However, the person creating the function can then use the argument in the future without forcing modification of code that calls the function.
2 numbers of arguments (Page 114)
2.1 an empty argument list
func(): In C++, it tells the compiler there are exactly zero arguments.
In C, it means an indeterminate number of arguments.
func(void): In C and C++, it means an empty argument list.
2.2 a variable argument list
func(...): you should restrict your use of variable argument lists in C and avoid them in C++.
3 Introduction to the pointers
Each of the elements in the program has a location in storage when the program is running. Even the function occupies storage.
4 Specifying storage allocation (Page 147)
gloal variables,
local variables,
register variables(avoided),
static variables(it is unavailable outside its definition scope, such as function scope or file scope. And you can define a function's local variable to be static and give it an initial value, the initialization is performed only the first time the function is call, and the data retains its value between function calls),
extern variables,
constants variables(a const must always hava an initialization value, and its value never change),
volatile variables(you will never know when this will change, and prevents the compiler from performing any optimizations based on the stability of that variable),
5 function address (Page 198)
Once a function is compiled and loaded into the computer to be executed, it occupies a chunk of memory. Thus the funciton has an address.
When you are looking at a complex definition, the best way to attack it is to start in the middle and work your way out. middle->right->left->right->
随机推荐
- mysql 5.7 多源复制 原创
一从两主:多源复制 每台mysql 服务器都需要加my.cnf要加两个参数才可以在GTID多源复制 master-info-repository=TABLE relay-log-info-reposi ...
- QQWry.dat 数据写入
纯真IP库 数据多,更新及时,很多同学在用,网上关于其读取的帖子也有不少(当然其中有一些是有BUG的),但却很少有关于其写入的帖子.OK,下面分享下写QQWry.dat. QQWry.dat 分三个部 ...
- 通过分析 JDK 源代码研究 TreeMap 红黑树算法实现--转
TreeMap 和 TreeSet 是 Java Collection Framework 的两个重要成员,其中 TreeMap 是 Map 接口的常用实现类,而 TreeSet 是 Set 接口的常 ...
- Windows 之 获取管理员权限
新建文本文档,写入如下内容: Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOT\*\shell\runas] [HKEY_CLASSES ...
- 由c#的值类型与引用类型说开去
之前一直被灌输,C#分值类型和引用类型,在程序运行时,它们分别存在栈(Stack) 和堆(Heap)上.这也是面试经典问题了,但其实其中存在很大的误解.比如某个实例对象中有一个Int型成员.当这个实例 ...
- JavaFX(三)窗口拖动
1.问题场景 在上一篇中,我们将窗口的默认标题栏隐藏从而导致鼠标点击窗体无法进行拖动. 2.解决思路 给组件添加鼠标按下事件监听器和鼠标拖动事件监听器. 3.代码实现 代码片段: private do ...
- jQuery之父:每天都写点代码
去年秋天,我的“兼职编程项目”遇到了一些问题:要不是从 Khan Academy 的项目里挪出时间来的话,我根本没办法将不理想的进度弥补上. 这些项目遇到了一些严重的问题.之前的工作我主要是在周末,有 ...
- hadoop学习记录(一)HDFS
hadoop的灵感源于谷歌,最初目的是解决传统数据库处理数据成本高和速度慢的问题. hadoop两个核心项目是HDFS(hadoop分布式文件系统)和MapReduce. HDFS用来实现数据的存储, ...
- Spring 事务管理高级应用难点剖析--转
第 1 部分 http://www.ibm.com/search/csass/search/?q=%E4%BA%8B%E5%8A%A1&sn=dw&lang=zh&cc=CN& ...
- 关于Eclipse的工作空间设置默认个数和配置
&