- 博客(6)
- 资源 (22)
- 收藏
- 关注
原创 【C++】计算struct结构体占用的长度
关于结构体和类所占用的长度计算方式介绍。struct A{ char a[5]; int b; short int c;}structA;在上例中,要计算 sizeof(a) 是多少?有两个原则:1)各成员变量存放的起始地址相对于结构的起始地址的偏移量必须为该变量的类型所占用的字节数的倍数即当 A中的a占用了5个字节后,b需要占用四个字节,此
2014-03-29 02:21:41 6322
原创 关于构造函数 c++
class F { public: F() {} F(int) {} void f() {}};void test() { F f1; F f2(); f1.f(); //可以正常执行 f2.f(); //会报错,因为编译认为F f2();是定义了一个返回值为F类型的函数,f2并不是F的对象,也无f
2014-03-28 23:41:56 891
原创 运行 XV6 记录
XV6项目是MIT学校的。主要用于操作系统教学。XV6源码:git clone git://pdos.csail.mit.edu/xv6/xv6.git接着就是 make 了。再最后就是运行。试了 bochs,qemu,kvm。最后是kvm成功了。安装kvm 就只用用 apt-get 就行了。运行:kvm -smp 1 -parallel std
2014-03-09 22:40:43 2571
原创 C++函数的重载
重载 overloaded : 同一作用域内,几个函数名字相同,但形参列表不同。(main 函数不能重载)eg.void print (const char *cp);void print (const int *beg, const int *end);void print (cosnt int ia[], size_t, size);下面的不是重载://仅仅是参
2014-03-04 11:53:53 954
原创 C++中的指针和引用,结合数组
聊以此文记录c++ primer的学习过程int a = 3;const int *b = &a; //可以这样,将非常量的地址赋给b //此时,b认为自己指向的是常量, //所以不能通过b去修改a的值const int &ar = a; // ar引用a,不能通过ar去修改a的值/*******************************/const int
2014-03-03 18:59:10 1115
转载 ubuntu运行xv6
此文用以记录过程xv6 可以在http://pdos.csail.mit.edu/6.828/2011/xv6.html 使用git clone下来,相当方便。而运行xv6的bochs,源代码包bochs-2.4.6.tar.gz可以从http://sourceforge.net/projects/bochs/下载注意:不能使用ubuntu上的a
2014-03-03 01:35:42 2301
hadoop 2.2.0 for eclipse plugin插件
2014-11-02
An Introduction to the Analysis of Algorithms
2014-09-01
Analytic Combinatorics [Philippe Flajolet / Robert Sedgewick ]
2014-09-01
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人