作者ric2k1 (Ric)
看板EE_DSnP
标题[闲聊] HW4
时间Mon Nov 16 23:52:11 2009
希望大家已经从期中考的深渊或是创伤中走出来了...
最近版上的人气很冷, 希望那不是指说大家都还没有开始写吧...?
其实作业四有它的难度, 除了大家要把上个礼拜上的内容弄懂之外,
还要 handle 更多的 code.
不知道怎麽下手的同学, 这里有两种建议:
1. 从 memMgr.h 开始
先不要管 commands, 就直接在 src/mem 目录底下写一个 testMem.cpp 的档案,
- #include "memMgr.h"
- Define a class to be memory managed. You can just copy the MemTestObj
from memTest.h here.
- Remember to put "MEM_MGR_INIT(className)" in the file scope
- Start your main()!!
Of course, you need to finish some TODOs in memMgr.h first.
You can start from "new" --> to implement getMem() first.
You can forget about recycling list if you do not do "delete".
You can forget about reset for now.
2. 从 command interface 开始
先测看看 command 下去之後有没有正确的 parse 进来.
至於 memMgr.h, 就先将 memTest.h 里面的 #include "memMgr.h" comment out 掉,
理论上你的 code 应该还是可以 compile.
(就是用系统的 new & delete, 而没有用你的 memory manager)
不过我刚刚测试发现我在 memTest.h 有两个地方没有写乾净:
In class MemTest:
void reset(size_t b = 0) {
_objList.clear(); _arrList.clear();
#ifdef MEM_MGR_H
MemTestObj::memReset(b);
#endif // MEM_MGR_H
}
void print() const {
#ifdef MEM_MGR_H
MemTestObj::memPrint();
#endif // MEM_MGR_H
...
然後在前面多 #include <cassert>
应该就可以 compile 了!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.224.41.150
1F:推 master1x4:正在看hw4说明pdf档中....QQ 11/16 23:57
2F:→ Asus08:还在期中考ing...HW4根本没时间>_< 而且大四要忙推甄找教授 11/17 00:37
3F:推 davidkid:...还没开始写HW4...(抖..明天还有最後一科..) 11/17 02:17
4F:推 noblebell:正在看hw4 word + 宿网坏掉.....QQ 11/17 18:35
5F:推 yclanner:还在期中考... 11/17 18:46