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->
随机推荐
- JAVA中调用CMD命令,并输出运行结果
package com.wzw.util; import java.io.BufferedReader; import java.io.InputStreamReader; public class ...
- iOS开发——UI_swift篇&TableView实现页眉和页脚
TableView实现页眉和页脚 在UItableView中header和footer是很常见的,而且他能让你实现很复杂的功能,我们见过最多的就是下拉刷新和上啦加载更多,当然你还可以在上面添加一个 ...
- MHA手动切换 原创2 (主参与复制)
monitor 执行下面命令后, --orig_master_is_new_slave :原主变为新从,即server1变成了slave1的从.slave2跟据app1.conf中配制也变成了slav ...
- 日志分析(三) kibana数据展示
kibana最新版本支持自定义数据大盘了,今天试用了下,感觉非常棒.上图: 支持多维度定义视图,然后视图里面可以依据粗粒度维度进行图表归类.总之,比旧版本强大太多了.后面试试能否扩展加入耦合一定业务数 ...
- SQL Server日期函数总结
获得一个月的天数:首先到得一个月最后一天的日期,通过 SQL Server 日期函数 day() 取得日期中的“天 ”部分 获得 2008 年 2 月份的天数:select day(cast('200 ...
- 网口扫盲三:以太网芯片MAC和PHY的关系
转载:http://www.cnblogs.com/jason-lu/articles/3195473.html 问:如何实现单片以太网微控制器? 答:诀窍是将微控制器.以太网媒体接入控制器(MA ...
- Linux shell 脚本攻略之文件查找与文件列表
摘自:<Linux shell 脚本攻略>
- i = i++;
在这里jvm里面有两个存储区,一个是暂存区(是一个堆栈,以下称为堆栈),另一个是变量区.语句istore_1是将堆栈中的值弹出存入相应的变量区(赋值):语句iload_1是将变量区中的值暂存如堆栈中. ...
- 小白日记33:kali渗透测试之Web渗透-扫描工具-Burpsuite(一)
扫描工具-Burpsuite Burp Suite是Web应用程序测试的最佳工具之一,成为web安全工具中的瑞士军刀.其多种功能可以帮我们执行各种任务.请求的拦截和修改,扫描web应用程序漏洞,以暴力 ...
- 关于mybatis用mysql时,插入返回自增主键的问题
公司决定新项目用mybatis,虽然这个以前学过但是一直没用过都忘得差不多了,而且项目比较紧,也没时间去系统点的学一学,只好很粗略的百度达到能用的程度就行了. 其中涉及到插入实体要求返回主键id的问题 ...