作者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