《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的更多相关文章

  1. Mongodb Manual阅读笔记:CH3 数据模型(Data Models)

    3数据模型(Data Models) Mongodb Manual阅读笔记:CH2 Mongodb CRUD 操作Mongodb Manual阅读笔记:CH3 数据模型(Data Models)Mon ...

  2. Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第二十三章:角色动画

    原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第二十三章:角色动画 学习目标 熟悉蒙皮动画的术语: 学习网格层级变换 ...

  3. Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第十一章:模板测试

    原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第十一章:模板测试 代码工程地址: https://github.co ...

  4. Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第六章:在Direct3D中绘制

    原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第六章:在Direct3D中绘制 代码工程地址: https://gi ...

  5. Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第四章:Direct 3D初始化

    原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第四章:Direct 3D初始化 学习目标 对Direct 3D编程在 ...

  6. Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第二章:矩阵代数

    原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第二章:矩阵代数 学习目标: 理解矩阵和与它相关的运算: 理解矩阵的乘 ...

  7. Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第一章:向量代数

    原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第一章:向量代数 学习目标: 学习如何使用几何学和数字描述 Vecto ...

  8. 阅读笔记 1 火球 UML大战需求分析

    伴随着七天国庆的结束,紧张的学习生活也开始了,首先声明,阅读笔记随着我不断地阅读进度会慢慢更新,而不是一次性的写完,所以会重复的编辑.对于我选的这本   <火球 UML大战需求分析>,首先 ...

  9. [阅读笔记]Software optimization resources

    http://www.agner.org/optimize/#manuals 阅读笔记Optimizing software in C++   7. The efficiency of differe ...

  10. 《uml大战需求分析》阅读笔记05

    <uml大战需求分析>阅读笔记05 这次我主要阅读了这本书的第九十章,通过看这章的知识了解了不少的知识开发某系统的重要前提是:这个系统有谁在用?这些人通过这个系统能做什么事? 一般搞清楚这 ...

随机推荐

  1. docker无法启动,报错grpc: addrConn.createTransport failed to connect to {unix:///run/containerd/containerd.

    docker无法启动,报错.k8s的pod镜像加载失败. 解法方法: 删除/var/lib/docker/和/var/lib/containerd/ 这两个文件夹,重起docker服务. 问题完美解决 ...

  2. 2021-11-15:四数相加 II。给你四个整数数组 nums1、nums2、nums3 和 nums4 ,数组长度都是 n ,请你计算有多少个元组 (i, j, k, l) 能满足:0 <= i,

    2021-11-15:四数相加 II.给你四个整数数组 nums1.nums2.nums3 和 nums4 ,数组长度都是 n ,请你计算有多少个元组 (i, j, k, l) 能满足:0 <= ...

  3. Django报错No module named django.core.urlresolvers

    当需要测试django能否解析网站根路径的URL,并将其对应到我们编写的某个视图函数上时,使用下面的语句 from django.core.urlresolvers import resolve 执行 ...

  4. PictureBox 从数据库加载图片照片

    Private Sub PAPHOTO_SEL() Try Dim objCon As SqlConnection Dim objCmd As SqlCommand '打开数据库 objCon = N ...

  5. 批处理bat and 汇编小技巧

    来自远古时期的汇编软件MASM是没有像现在一样的exe程序的(汇编萌新的认知),所以为了快捷,写一些bat来方便操作.([表情包]奇怪的知识增加了)哈哈哈 我现在是MASM的路径是D:\Masm64\ ...

  6. More than one file was found with OS independent path 'lib/armeabi-v7a/libflutter.so'

    今日一个flutter 整合ai到原生android 时老是提示如下错误 Caused by: com.android.builder.merge.DuplicateRelativeFileExcep ...

  7. 代码随想录算法训练营Day45 动态规划

    代码随想录算法训练营 代码随想录算法训练营Day45 动态规划|70. 爬楼梯(进阶) 322. 零钱兑换 70. 爬楼梯 (进阶) 题目链接:70. 爬楼梯 (进阶 假设你正在爬楼梯.需要 n 阶你 ...

  8. 第一课 使用开发者模式快速入门 Odoo 13

    Odoo提供了一个快速应用开发框架,非常适合创建商业应用.这类应用通常用于保留业务记录,增删改查操作.Odoo 不仅简化了这类应用的创建,还提供了看板.日历.图表等视图的丰富组件,用于创建好看的用户界 ...

  9. Road

    首先进行端口扫描22 80 使用nmap进行vuln nmap -sS --script=vuln 10.10.236.244 10.10.236.244/v2/admin/login.html 随便 ...

  10. 【python基础】循环语句-while循环

    1.初识while循环 循环语句主要的作用是在多次处理具有相同逻辑的代码时使用.while循环是Python提供的循环语句之一. while循环的语法格式之一: 比如我们输出1-10之间的奇数,编写程 ...