该文被密码保护。 阅读全文
posted @ 2014-09-21 21:51 tilly_chang 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 数据存储优先顺序的转换计算机数据存储有两种字节优先顺序:高位字节优先(称为大端模式)和低位字节优先(称为小端模式)。内存的低地址存储数据的低字节,高地址存储数据的高字节的方式叫小端模式。内存的高地址存储数据的低字节,低地址存储数据高字节的方式称为大端模式。eg:对于内存中存放的数0x12 34 56... 阅读全文
posted @ 2014-09-21 21:22 tilly_chang 阅读(2936) 评论(0) 推荐(0) 编辑
摘要: 引言条件变量是利用线程间共享的全局变量进行同步的一种机制,主要包括两个动作:一个线程等待条件变量的条件成立而挂起(此时不再占用cpu);另一个线程使条件成立(给出条件成立信号)。为了防止竞争,条件变量的使用总是和一个互斥锁结合在一起。函数原型1. 定义条件变量#include /* 定义两个条件变量... 阅读全文
posted @ 2014-09-21 21:05 tilly_chang 阅读(248) 评论(2) 推荐(0) 编辑
摘要: #include #include #include #include #include #define CNT 20 /* 最多生产20个产品 *//* 用队列模拟车间 *//* front和tail初始化均为0,tail是下一个资源生成的下一个数组空间下标 */typedef... 阅读全文
posted @ 2014-09-21 21:03 tilly_chang 阅读(357) 评论(0) 推荐(0) 编辑
摘要: $ git config --global user.name "Firstname Lastname"$ git config --global user.email "your_email@your_email.com"设置你的用户和邮箱。$ git init将一个文件夹纳入git版本控制。$ ... 阅读全文
posted @ 2014-09-21 20:46 tilly_chang 阅读(160) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #define N 20static void show(int *arr, int len){ int index; for(index = 0; index 前N-1个数放好位置,最后一个数就不用管了 */static void ... 阅读全文
posted @ 2014-09-21 20:11 tilly_chang 阅读(165) 评论(0) 推荐(0) 编辑
摘要: (一)inline函数(摘自C++ Primer的第三版)在函数声明或定义中函数返回类型前加上关键字inline即把min()指定为内联。 inline int min(int first, int secend) {/****/};inline函数对编译器而言必须是可见的,以便它能够在调用点内展开... 阅读全文
posted @ 2014-09-18 00:33 tilly_chang 阅读(162) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std;//对于不同的异常可以采取不同的catch块进行捕捉int main(int argc, const char *argv[]){ try { int i; ... 阅读全文
posted @ 2014-09-18 00:08 tilly_chang 阅读(1690) 评论(0) 推荐(1) 编辑
摘要: #include #include #include using namespace std;int BinSearch(vector ivec, int key) //循环实现的二分查找要比递归实现效率要高很多,推荐使用这种方法{ int low = 0, high = ivec.siz... 阅读全文
posted @ 2014-09-17 23:52 tilly_chang 阅读(307) 评论(0) 推荐(0) 编辑
摘要: C语言可以采用函数名作为唯一标示。C++中函数的唯一标示是,函数签名(signature),不仅包括函数的名字,还包括参数列表等。但是不包括函数返回值。C++对函数名进行名字改编 (name mangling) : nm -A详情请参考 C++ 第七章 阅读全文
posted @ 2014-09-17 19:37 tilly_chang 阅读(147) 评论(0) 推荐(0) 编辑