Programming abstractions in C阅读笔记:p127-p129
《Programming Abstractions In C》学习第51天,p127-p129,总结如下:
一、技术总结
1. string library
掌握常用函数如strlen,strcpy用法。
2.buffer overflow(缓冲区溢出)
(1)什么是buffer?
p129,Arrays that are preallocated and later use as a repository for data called buffers。
(2)什么是缓冲区溢出?
p129,Writing data past the end of an buffer is a common programming error called buffer overflow。
//buffer overflow示例
char *src = "Hello";
char dst[1]; // dst称为buffer
strcpy(dst, src); // 该操作会导致buffer overflow问题
书中只是做一个简单的说明,具体可参考:
(1) wikipedia, Buffer overflow: https://en.wikipedia.org/wiki/Buffer_overflow
二、英语总结
1.“The function will go ahead and copy characters right on past the end of the buffer.”语法分析
答:这里的应该是The function will go ahead and (copy characters right) (on past the end of the buffer),这句话有几个要注意的地方:
(1)right
adv. exactly or all the way(完全地),指的是“一直复制/继续复制”。在原文中也有一点"强调"的意思--虽然字符串已经超过了缓冲区的长度(Buffersize),但是strcpy函数还是会复制。当然,副词在句子中往往可以忽略,直接理解为copy也是可以的。
(2)on the end
这里之所以用on, 可能是因为data对buffer而言是on,例如:I have a pimple right on the end of my nose。参考:https://ell.stackexchange.com/questions/111682/on-the-end-of-something
(3)past
这里为什么使用past呢?如果不用,那么on the end of buffer也说得通。这里之所以用past,表示已经超过了缓冲区,past取“prep. to a position that is further than a particular point”之意。
2.obligation什么意思?
答:
(1)oblige:ob-("to") + ligare("to bind"),to bind by oath(以誓言约束)。
(2)oblige > obligation:obligation的意思是“n. the fact that you are obliged to do sth”(义务,责任)
p129,"you have an obligation to check the length of the source string before you copy it using strpy"。
3.equivalent of语法分析
答:p129,“Thus,the Pig Latin equivalent of any is anyway”,初看到这句话的时候心里是困惑的,因为记忆中都是把equivalent当做形容词用,后面接to。这里接of,那么就是用作名词:n. sth that has the same amount,value, purpose etc as sth else。
三、参考资料
1. 编程
(1)Eric S.Roberts,《Programming Abstractions in C》:https://book.douban.com/subject/2003414
2. 英语
(1)Etymology Dictionary:https://www.etymonline.com
(2) Cambridage Dictionary:https://dictionary.cambridge.org
欢迎搜索及关注:编程人(a_codists)
Programming abstractions in C阅读笔记:p127-p129的更多相关文章
- Mongodb Manual阅读笔记:CH3 数据模型(Data Models)
3数据模型(Data Models) Mongodb Manual阅读笔记:CH2 Mongodb CRUD 操作Mongodb Manual阅读笔记:CH3 数据模型(Data Models)Mon ...
- Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第二十三章:角色动画
原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第二十三章:角色动画 学习目标 熟悉蒙皮动画的术语: 学习网格层级变换 ...
- Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第十一章:模板测试
原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第十一章:模板测试 代码工程地址: https://github.co ...
- Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第六章:在Direct3D中绘制
原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第六章:在Direct3D中绘制 代码工程地址: https://gi ...
- Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第四章:Direct 3D初始化
原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第四章:Direct 3D初始化 学习目标 对Direct 3D编程在 ...
- Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第二章:矩阵代数
原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第二章:矩阵代数 学习目标: 理解矩阵和与它相关的运算: 理解矩阵的乘 ...
- Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第一章:向量代数
原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第一章:向量代数 学习目标: 学习如何使用几何学和数字描述 Vecto ...
- 阅读笔记 1 火球 UML大战需求分析
伴随着七天国庆的结束,紧张的学习生活也开始了,首先声明,阅读笔记随着我不断地阅读进度会慢慢更新,而不是一次性的写完,所以会重复的编辑.对于我选的这本 <火球 UML大战需求分析>,首先 ...
- [阅读笔记]Software optimization resources
http://www.agner.org/optimize/#manuals 阅读笔记Optimizing software in C++ 7. The efficiency of differe ...
- 《uml大战需求分析》阅读笔记05
<uml大战需求分析>阅读笔记05 这次我主要阅读了这本书的第九十章,通过看这章的知识了解了不少的知识开发某系统的重要前提是:这个系统有谁在用?这些人通过这个系统能做什么事? 一般搞清楚这 ...
随机推荐
- Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp; nested exception is java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
好久没记录了,最近一直在忙着工作以及码前后端 记录下这种大多数人都会碰到但是又不一定找得到问题的错误 1 Value '0000-00-00 00:00:00' can not be represen ...
- 【一步步开发AI运动小程序】二、引入插件
随着人工智能技术的不断发展,阿里体育等IT大厂,推出的"乐动力"."天天跳绳"AI运动APP,让云上运动会.线上运动会.健身打卡.AI体育指导等概念空前火热.那 ...
- 有管django使用orm 字段报错问题
直接删除表,重新生成,首先删除:migrations 中,上传记录,然后django_migrations,
- IntelliJ IDEA 的初次使用--/护头
IntelliJ IDEA 的使用 使用前先完成以下两点 环境配置 Win10环境配置(二) --Java篇 软件安装 IntelliJ IDEA 的安装 在完成软件安装,打开软件的瞬间,我是懵逼的. ...
- 基于SqlSugar的开发框架循序渐进介绍(31)-- 在查询接口中实现多表联合和单表对象的统一处理
在一些复杂的业务表中间查询数据,有时候操作会比较复杂一些,不过基于SqlSugar的相关操作,处理的代码会比较简单一些,以前我在随笔<基于SqlSugar的开发框架循序渐进介绍(2)-- 基于中 ...
- Qt+QtWebApp开发笔记(五):http服务器html中使用json触发ajax与后台交互实现数据更新传递
前言 前面完成了页面的跳转.登录,很多时候不刷新页面就想刷新局部数据,此时ajax就是此种技术,且是异步的. 本篇实现网页内部使用js调用ajax实现异步交互数据. 在js中使用 ajax是通 ...
- 用声明式宏解析 Rust 语法
在上一篇 Rust 声明式宏中的 Metavariables 有哪些 的基础上, 今天尝试解析一下 Rust 中的几种 item.我们知道一个 crate 是由 item 组成的,每一个 fn str ...
- 8. 自定义映射resultMap
在 Mybatis 中,resultType 和 resultMap 都用于定义查询结果的映射关系.它们的使用场景如下: resultType resultType 用于指定返回结果的数据类型,通 ...
- PyTorch与机器学习中的随机化:减少噪声和随机性
目录 2.1 基本概念解释 2.2 技术原理介绍 2.3 相关技术比较 3. 实现步骤与流程 3.1 准备工作:环境配置与依赖安装 3.2 核心模块实现 3.3 集成与测试 4. 应用示例与代码实现讲 ...
- 生成式预训练Transformer在机器翻译中的应用与挑战
目录 1. 引言 2. 技术原理及概念 3. 实现步骤与流程 4. 应用示例与代码实现讲解 5. 优化与改进 6. 结论与展望 机器翻译是人工智能领域的重要应用之一,而生成式预训练Transforme ...