作者noblebell (高贵的铃)
看板EE_DSnP
标题[问题] 关於charDef.cpp的疑问
时间Mon Oct 19 20:36:57 2009
小弟在看懂charDef.cpp的过程中,有下列疑惑,让我难以看懂後续的code:
1、在老师上课说enum让数字有名字,可是下列17、18行似乎不是给数字一个名字,
可是它的意思是什麽?
摘自:charDef.cpp
14 enum ParseChar
15 {
16 // Meta type
17 MOD_KEY_SHIFT = 1 << 8, // shifted 8 bits (char size; as char mask)
18 ARROW_BASE_SHIFT = 1 << 9,
2、在charDef.cpp,有呼叫istream的mem funx:XXXX.eof(),我查了它的用法,可是我
看来看去还是看不懂它的意思@@
The function returns true if the eofbit stream's error flag has been set by a
previous i/o operation. This flag is set by all standard input operations
when the End Of File is reached in the sequence associated with the stream.
ps.如果以上问题太简单,看倌请在心里面小力地嘘我。
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.251.6
※ 编辑: noblebell 来自: 140.112.251.6 (10/19 20:37)
※ 编辑: noblebell 来自: 140.112.251.6 (10/19 20:37)
1F:推 timrau:1. 确实是给数字名字,只是数字分别为(2^8) 和 (2^9) 10/19 20:43
2F:→ timrau:2. 如果以前有一次读这个istream却因为遇到end of file 10/19 20:44
3F:→ timrau:而失败,则以後call XXXX.eof()就会得到true 10/19 20:44
4F:→ timrau:所以关键在於:碰到档尾的"下一次"eof()才会return true 10/19 20:45
5F:→ noblebell:哦哦~了解了,谢谢。 10/19 20:51
6F:推 herbert570:第一题17行是把"1"的bit向左移动8bit,所以会变成 256 10/20 08:32