Daily Archives: September 17, 2019

ASCII (annotated)

參考 https://en.cppreference.com/w/c/language/ascii 作一些補註 ASCII定義0x00-0x7F,超過的部分(第8bit)算是extended 8bit,看不同的標準有不同的定義,早期有些拿來當成parity bit 總共有128個character,其中95個是printable(0x20-0x7E),前32個和最後一個是control characters (0x00-0x1F/0-31, 0x7F/127)。 數字的安排對應BCD的bit pattern(加上了011->hex 3),簡單來說0 -> 0x30、9-> 0x39,只要 &0x0F 就可以得到數字。 可以用每32個字元為單位分成四快來看,第一塊是控制字元、第二塊(數字)第三塊(大寫字母)他的順序安排有些歷史因素,可對比以下的DEC SIXBIT、第四塊是小寫字母。 上面順便列出EBCDIC(發音: eb-SEE-dick) 供比較,主要使用在IBM mainframe上,注意大部分可印字元集中在後半區,並且A-Z, a-z並不是連續的

Posted in C Language | Leave a comment

C/C++ comments (annotated)

參考 https://en.cppreference.com/w/c/comment整理一些注意的重點 All comments are removed from the program at translation phase 3 by replacing each comment with a single whitespace character. 這裡描述在translation phase3對於comment做的事,用一個space character取代 translation phase 3可參考C99 §5.1.1.2 (p.10) 3. The source file is decomposed into preprocessing tokens6) and … Continue reading

Posted in C Language | Leave a comment

freestanding program

https://en.cppreference.com/w/c/language/basic_concepts 裡提到 A C program is a sequence of text files (typically header and source files) that contain declarations. They undergo translation to become an executable program, which is executed when the OS calls its main function (unless it is … Continue reading

Posted in C Language | Leave a comment