-
Recent Posts
Recent Comments
Categories
Links
Monthly Archives: September 2019
Keywords (annotated)
The above tokens (case sensitive) are reserved (in translation phases 7 and 8) for use as keywords, and shall not be used otherwise. keywords出現在phase7開始,在之前是屬於preprocessor token的identifier 上面的紅框是C99新增的keyword,_Bool定義成_Bool而不是bool,主要的原因是在C89的標準中,對於reserved identifier是用 底線+大寫字母開頭 或是 雙底線。提供了後續標準新增的關鍵字避免使用上與使用者衝突。另外在標準中提到 Implementation-defined keywords shall have the form of an identifier reserved … Continue reading
Posted in C Language
Leave a comment
Identifier (annotated)
參考: https://en.cppreference.com/w/c/language/identifier 有關C99 identifier的定義 6.4.2.1 An identifier is a sequence of nondigit characters (including the underscore _, the lowercase and uppercase Latin letters, and other characters) and digits. C99也支援universal-character-name \u or \U開頭的UCN來作為identifier的字元(可以在identifier開頭) \u接4個hex \U接8個hex 當然也考慮了上面提到的不能digit開頭的限制 Each universal character name in … Continue reading
Posted in C Language
Leave a comment
C99 Terms, definitions, and symbols (annotated)
整理一下C99在Terms, definitions, and symbols提到的一些名詞定義的重點整理,總共有19個。 3.1 access 在標準中提到的access 即是對object存取,read or modify。這裡modify包含對object存入相同的值 ‘Modify’ includes the case where the new value being stored is the same as the previous value 另外是如果Expressions沒有被evaluate就沒有access(例如short circuit evaluation) Expressions that are not evaluated do not access objects. 3.2 … Continue reading
Posted in C Language
Leave a comment
Phases of translation (annotated)
在C99的translation phases共分8步 。translation phases描述了從C source code到program image的處理流程。 參考整理 https://en.cppreference.com/w/c/language/translation_phases &ISO C99標準 The C source file is processed by the compiler as if the following phases take place, in this exact order. Actual implementation may combine these actions or process them … Continue reading
Posted in C Language
Leave a comment
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
vim
在vim預設會在檔案尾加上 例如 用hexdump工具看 hexdump -C 代表的是該行結束,接下來的內容會出現在新的一行。 在檔尾的EOL在使用unix工具filter時很重要, 像是多個檔案cat 如果沒有完整行,則下一個檔案的內容會直接接上來 或是計算字數行數的wc: 只會計算完整行 如下面的範例 但有時候可能因為某些原因編輯時需要刻意不加上檔案尾的 要關掉可以下 :set noendofline binary 注意: 只有noendofline還不夠,需要設定成binary 參考: https://stackoverflow.com/questions/16222530/why-do-i-need-vim-in-binary-mode-for-noeol-to-work
Posted in Tips
Leave a comment
chromium with h265 build download
https://chromium.woolyss.com [all codecs] video test page: https://tools.woolyss.com/html5-audio-video-tester/
Posted in System Administration
Leave a comment