2013年3月31日
摘要: 1. 比较两数大小相减之后看符号位#defineCMP(a,b)(((long)((a)-(b))) >> 31) - (((long)((b)-(a))) >> 31)返回1表示a>b,返回-1表示a<b,返回0表示a==b2. 求两数最大值 阅读全文
posted @ 2013-03-31 22:50 chenkkkabc 阅读(300) 评论(0) 推荐(0) 编辑
摘要: 1. 转换成二进制进行加法int bit_add(int a ,int b){ int carry = a & b; int no_carry_sum = a ^ b; if (carry != 0) { return bit_add(carry << 1, no_carry_sum); } else{ return no_carry_sum; } return 0;}2. 利用数组下标特性int arr_idx_add(int a, int b){ char* c = (char*) a; return (int)&c[b];} 阅读全文
posted @ 2013-03-31 19:27 chenkkkabc 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 写段代码测试一下变量的内存分布:#include <cstdlib>#include <cstdio>char bss_global;char rw_data_global = 0;const char ro_data1 = 0;static char rw_data_static = 0;int main() { static char bss_static; char stack1; char stack2[] = {"Hello world!"}; const char stack3 = 0; const char* ro_data2 = &q 阅读全文
posted @ 2013-03-31 12:59 chenkkkabc 阅读(168) 评论(0) 推荐(0) 编辑
  2013年3月30日
摘要: 32位内存经典布局 / +----------------------------------------+ 0xFFFFFFFF1GB | Kernel Space | \ +----------------------------------------+ 0xC0000000 == TASK_SIZE / | Stack ↓ || +----------------------------------------+| | || +----------------------------------------+| | Memory Mapping Region ↑ || +------- 阅读全文
posted @ 2013-03-30 13:42 chenkkkabc 阅读(218) 评论(0) 推荐(0) 编辑
  2013年3月28日
摘要: 制定目标要掌握的原则:SpecificMeasurableAttainableRelevantTime-bound 阅读全文
posted @ 2013-03-28 21:28 chenkkkabc 阅读(138) 评论(0) 推荐(0) 编辑
  2013年3月27日
摘要: 普通应用程序的缩影Create 创建Read / Retrieve 读取Update 更新Delete / Destroy 删除 阅读全文
posted @ 2013-03-27 20:40 chenkkkabc 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 内部能力:StrengthWeakness外部因素:OpportunityThreat 阅读全文
posted @ 2013-03-27 20:36 chenkkkabc 阅读(132) 评论(0) 推荐(0) 编辑
  2013年3月23日
摘要: Linux程序员通过补丁文件(patch)进行代码交流。diff来创建patch文件diff -u original new > original.patchdiff -ruN original/ new/ > original.patchpatch来应用patch文件patch -p0 < original.patch-p[NUM] 表示去掉补丁文件的路径 NUM个 / 阅读全文
posted @ 2013-03-23 14:55 chenkkkabc 阅读(160) 评论(0) 推荐(0) 编辑
  2013年3月20日
摘要: C语言关键字共有44个 autoenumrestrict (c99)unsigned_Imaginary (c99)breakexternreturnvoid_Noreturn (c11)casefloatshortvolatile_Static_assert (c11)charforsignedwhile_Thread_local (c11)constgotosizeof_Alignas (c11)continueifstatic_Alignof (c11)defaultinline (c99)struct_Atomic (c11)dointswitch_Bool (c99)doublelo 阅读全文
posted @ 2013-03-20 10:17 chenkkkabc 阅读(163) 评论(0) 推荐(0) 编辑
  2013年3月19日
摘要: 硬连接(hard link)创建:ln source target.hlink| filename | inode # |+--------------------+ \ >-------> | permbits, etc | addresses | / +---------inode-------------+| othername | inode # | \+---------------------+ `--------> | data | | data | etc +------+ +------+多个硬连接指向同一个inode。引用计数为0且无进程打开时可以删除文件 阅读全文
posted @ 2013-03-19 17:25 chenkkkabc 阅读(189) 评论(0) 推荐(0) 编辑