Programming abstractions in C阅读笔记p111-p113: boilerplate
《Programming Abstractions In C》学习第47天,p111-p113,总结如下:
一、技术总结
1.boilerplate
/*
* File: random.h
* Version: 1.0
* Last modified on Fri Jul 22 16:44:36 1994 by eroberts
* -----------------------------------------------------
* This interface provides several functions for generating
* pseudo-random numbers.
*/
#ifndef _random_h
#define _random_h
#include "genlib.h"
#include <stdlib.h>
/*
* Constant: RAND_MAX
* ------------------
* Unfortunately, several libraries that supposedly conform to
* the ANSI standard do not define RAND_MAX in <stdlib.h>. To
* reduce portability problems, this interface defines RAND_MAX
* to be the largest positive integer if it is undefined.
*/
#ifndef RAND_MAX
# define RAND_MAX ((int) ((unsigned) ~0 >> 1))
#endif
/*
* Function: Randomize
* Usage: Randomize();
* -------------------
* This function sets the random seed so that the random sequence
* is unpredictable. During the debugging phase, it is best not
* to call this function, so that program behavior is repeatable.
*/
void Randomize(void);
/*
* Function: RandomInteger
* Usage: n = RandomInteger(low, high);
* ------------------------------------
* This function returns a random integer in the range low to high,
* inclusive.
*/
int RandomInteger(int low, int high);
/*
* Function: RandomReal
* Usage: d = RandomReal(low, high);
* ---------------------------------
* This function returns a random real number in the half-open
* interval [low .. high), meaning that the result is always
* greater than or equal to low but strictly less than high.
*/
double RandomReal(double low, double high);
/*
* Function: RandomChance
* Usage: if (RandomChance(p)) . . .
* ---------------------------------
* The RandomChance function returns TRUE with the probability
* indicated by p, which should be a floating-point number between
* 0 (meaning never) and 1 (meaning always). For example, calling
* RandomChance(.30) returns TRUE 30 percent of the time.
*/
bool RandomChance(double p);
#endif
p113,These three lines are often referred to as interface boilerplate。boilerplate这个词会在计算机相关的教材中会经常看到,英文的意思是:“text that can be copied and used in computer program,with only small changes.”(模板),之所以叫模板,是因为在每个头文件中都有这三句。这个单词不难理解,关键是通过此次的教材对这个单词有一个具体的、形象的记录,当提到这个单词,就知道具体指的是什么。
二、英语总结
1.roll a die一句里面的die是什么意思?
答:die: n.a small cube with a different number of spots on each side.(骰子),所以roll a die的就是"掷骰子"。
2.along with语法
答:along with在表示伴随、以及或连同等意思时,两者之间无先后顺序,可能在前也可能在后。这点与follow不同。示例:For each of these functions, the interface contains one-line prototype along with a comment that describe the purpose of the function from the perspective of clients.
3.up to 语法
答:原文:The line:
#ifndef _random_h
cause the compiler to skip any text up to the #endif line if the the symbol _random_h has been previously defined。
up to短语主要有两种用法:
(1)adv. used to say that sth is less than or equal to but not more than a stated value。
(2)adv. until。
都表示的是“程度”,而不是“方向”。
三、参考资料
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阅读笔记p111-p113: boilerplate的更多相关文章
- 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 这次我主要阅读了这本书的第九十章,通过看这章的知识了解了不少的知识开发某系统的重要前提是:这个系统有谁在用?这些人通过这个系统能做什么事? 一般搞清楚这 ...
随机推荐
- 2022-10-06:以下go语言代码输出什么?A:[1 2 3] [1 2 3] ;B:[1 2 3] [3 4 5]; C:[1 2 3] [3 4 5 6 7 8 9];D:[1 2 3] [3
2022-10-06:以下go语言代码输出什么?A:[1 2 3] [1 2 3] :B:[1 2 3] [3 4 5]: C:[1 2 3] [3 4 5 6 7 8 9]:D:[1 2 3] [3 ...
- 2020-11-22:mysql中,什么是filesort?
福哥答案2020-11-22:[答案来自此链接:](http://bbs.xiangxueketang.cn/question/412)如果mysql在排序的时候没有使用到索引那么就会输出 using ...
- drf-spectacular
介绍 drf-spectacular是为Django REST Framework生成合理灵活的OpenAPI 3.0模式.它可以自动帮我们提取接口中的信息,从而形成接口文档,而且内容十分详细,再也不 ...
- vue全家桶进阶之路27:Vue.js 3.0的下载和安装
使用脚手架vue-cli创建vue3项目,创建前需要准备以下: 1.node.js环境 见:https://www.cnblogs.com/beichengshiqiao/p/17251233.htm ...
- vue全家桶进阶之路17:组件与组件间的通信
在 Vue2 中,组件与组件之间的通信可以通过以下几种方式来实现: Props 和 Events 这是 Vue2 中最基础和常用的父子组件通信方式.父组件通过属性传递数据给子组件,子组件通过事件触发向 ...
- 【GiraKoo】线程本地存储(Thread Local Storage, TLS)
[技术分享]线程本地存储(Thread Local Storage, TLS) 在项目开发中,遇到了关于TLS相关的问题.为了了解该机制的用途,在微软的官网查找了一些资料. 本文参考官方文档, 简单介 ...
- Java(if选择、switch选择、循环)
1.if 选择结构 //语法 if(表达式){ //语句:(表达式为真) }else{ //语句:(表达式为假) } --------------------------------------- 例 ...
- 使用镜像加速 Rtools 下载与安装
在 windows 使用 R,尤其是安装 R 包的时候,经常会遇到一些 Rtools 的问题,今天聊一下. Rtools 是什么 Rtools 作用很大,但我们一般不怎么会直接使用. Rtools p ...
- 喜报 | ShowMeBug获国家高新技术企业认证!
近日,深圳至简天成科技有限公司(以下简称至简天成)顺利通过国家高新技术企业认证! 国家高新技术企业是由国务院主导.科技部牵头的国家级荣誉资质,是我国科技类企业中的"国"字号招牌,完 ...
- OpenAI发布ChatGPT函数调用和API更新
2023年6月13日,OpenAI针对开发者调用的API做了重大更新,包括更易操控的 API模型.函数调用功能.更长的上下文和更低的价格. 在今年早些时候发布gpt-3.5-turbo,gpt-4在短 ...