C言語国際規格 ISO/IEC 9899 C2011原案N1570
コンパイルした記録の一覧
この資料のOriginal:https://github.com/Clanguagesubset/c2011/wiki
例題コンパイル作業
CN2011の例題をコンパイルする作業手順を記録。
MISRA-Cの例題をコンパイルする場合も類似。
1 コンパイル可能な記述を探す。<文書>
2 章・節の見出しを複写<文書>
3 エディタで新規ファイルを選ぶ。<エディタ>
4 章・節の見出しを貼り付け。<エディタ>
5 既存のファイルを複写。<エディタ>
6 章・節の見出しを上書き。<エディタ>
7 最終出力printfの章・節の見出し事項を上書き。<エディタ>
8 例題を複写。<文書>
9 例題を貼り付ける際に、既存の処理の上に上書き。<エディタ>
10 ソースコードファイルを章・節の数字に基づくファイル名で保存。<エディタ>
10 コンパイル。<コマンド>
11 (エラーが出れば)変数宣言など自明な処理を追加。<エディタ>
12 (必要があれば)処理の経過and/or結果が分かる出力を追加。<エディタ>
13 実行した結果を複写。<コマンド>
14 最後に貼り付ける。<エディタ>
15 最終保存。<エディタ>
16 ファイルをresearchmap.jpに貼り付け。<ブラウザ>
17 LLVM 3.2で対応できないものは、GCC 4.9でコンパイル。
18 GCCの著作権表示と出力がGCCによることを追記。
コンパイルエラー除去方針
1 宣言がないものは宣言を追加する。
2 実行部分はint main(void)に入れる。
3 関数の実体がないものは関数の実体を最小限入れる。
例えば、return 0;のように。
4 コンパイルエラー、警告の出力が目的のコードは、目的以外の警告がでないようにする。
5 コンパイルエラー、警告の出力が目的でない場合には、エラー、警告が出た状態のままにすることがある。
例えば、初期値の代入、出力の型の違いなど。
6 なるべく一つの章・節では1つの例題とする。
7 複数の例を同一のファイルにすると変数名の衝突などがある場合は、最低限の変数の変更に留める。
例えば、char c; int c;とある場合には、char c; int ic;とする。
出力方針。
1 最終出力に、章・節番号と見出しを入れ改行する。
2 経過・結果に影響を与える出力に限定する。
3 複数の例を同一ファイルにしている場合には、例ごとに出力しできれば改行する。
4 出力形式は%dとする。文字列の出力が必要な場合は%sも併用することがある。
<この稿は書きかけです。順次追記しています。>
作業一覧(最初から最後まで)
C2011 3.14 memory location: example
C2011 3.20 ceiling, 3.21 floor : Example
C2011 4. Conformance fesetround(FE_UPWARD)
C2011 5.1.1.3 Diagnostics : constraint error
C2011 5.1.2.3 Program execution : Examples 1-6
C2011 5.1.2.3 Program execution : getchar Example 7
C2011 5.2.1.1 Trigraph sequences: Examples
C2011 6.2.7 Compatible type and composite type
C2011 6.4.2.2 Predefined identifiers: func
c2011 6.4.5 String literals :Example
C2011 6.4.7 Header names:Example
C2011 6.4.9 Comments: Example
C2011 6.5 Expressions : undefined
C2011 6.5.1.1 Generic selection: _Generic
C2011 6.5.2.1 Array subscripting, Example
C2011 6.5.2.2 Function calls: Example
C2011 6.5.2.3 Structure and union members: Examples
C2011 6.5.2.4 Postfix increment and decrement operators:note 98)
C2011 6.5.3.4 The sizeof and _Alignof operators:Examples
c2011 6.5.2.5 Compound literals: Examples
C2011 6.5.9 Equality operators, notes 108)
C2011 6.5.15 Conditional operator: EXAMPLE
C2011 6.5.16.1 Simple assignment: Examples
C2011 6.5.16.2 Compound assignment: Note 113)
C2011 6.5.17 Comma operator: Example
C2011 6.7.2.1 Structure and union specifiers //Examples
C2011 6.7.2.2 Enumeration specifiers // Example
C2011 6.7.2.3 Tags // Examples
C2011 6.7.3 Type qualifiers // Examples
C2011 6.7.3.1 Formal definition of restrict // Examples
C2011 6.7.4 Function specifiers, _Noreturn
C2011 6.7.6.1 Pointer declarators // Example
C2011 6.7.6.2 Array declarators // Examples
C2011 6.7.6.3 Function declarators (including prototypes) // Examples
C2011 6.7.7 Type names
C2011 6.7.8 Type definitions // Examples
C2011 6.7.9 Initialization // Examples
C2011 6.8.3 Expression and null statements // Examples
C2011 6.8.4.2 The switch statement // Example
C2011 6.8.6.1 The goto statement // Examples
C2011 6.8.6.2 The continue statement // Semantics
C2011 6.8.6.4 The return statement // Example
C2011 6.9.1 Function definitions // Note 141) and Examples
C2011 6.9.2 External object definitions, //Examples
C2011 6.10 Preprocessing directives // Example
C2011 6.10.1 Conditional inclusion // Example
C2011 6.10.2 Source file inclusion //Examples
C2011 6.10.3.3 The ## operator // Example
C2011 6.10.3.5 Scope of macro definitions// Examples
C2011 6.10.9 Pragma operator // Example
C2011 7.1.4 Use of library functions //note 163) and Example
C2011 7.3.9.5 The creal functions // note 171)
C2011 7.6.1 The FENV_ACCESS pragma // Example
C2011 7.6.3.2 The fesetround function // Example
C2011 7.6.4.4 The feupdateenv function // Example
C2011 7.8.1 Macros for format specifiers // Example
C2011 7.12.3.1 The fpclassify macro // Example
C2011 7.13.2.1 The longjmp function // Example
C2011 7.16.1.4 The va_start macro // Example
C2011 7.17.2.1 The ATOMIC_VAR_INIT macro // Example
C2011 7.17.2.2 The atomic_init generic function // Example
C2011 7.17.3 Order and consistency //NOTES 3
C2011 7.17.7.4 The atomic_compare_exchange generic functions // Example
C2011 7.17.8 Atomic flag type and operations // Example
C2011 7.21.6.1 The fprintf function // Examples
C2011 7.21.6.2 The fscanf function // Examples
C2011 7.21.6.8 The vfprintf function // Example
C2011 7.22.2.2 The srand function // Example
C2011 7.24.4.5 The strxfrm function // Example
C2011 7.24.5.8 The strtok function // Example
C2011 7.25 Type-generic math //Example
C2011 7.27.2.3 The mktime function // Example
C2011 7.29.2.1 The fwprintf function // Example
C2011 7.29.2.2 The fwscanf function // Example
C2011 7.29.2.5 The vfwprintf function // Example
C2011 7.29.4.4.4 The wcsxfrm function // Example
C2011 7.29.4.5.7 The wcstok function // Example
C2011 F.8.4 Constant expressions // Example
C2011 F.8.5 Initialization // Example & note 367)
C2011 F.9.1 Global transformations // for example
C2011 F.9.3 Relational operators // Example
C2011 G.5.1 Multiplicative operators // Examples
C2011 K.3.5.3.2 The fscanf_s function // Examples
C2011 K.3.7.1.4 The strncpy_s function
C2011 K.3.7.2.2 The strncat_s function // Example
C2011 K.3.7.3.1 The strtok_s function // Example
C2011 K.3.9.2.1.2 The wcsncpy_s function // Example
C2011 K.3.9.2.2.2 The wcsncat_s function // Example
C2011 K.3.9.2.3.1 The wcstok_s function // Example
gcc-4.9 -std=c11 c2011-6-10-3-5-ex.c -E
C2011 6.10.3.4 Rescanning and further replacement //Example
5.2.4.2.2 Characteristics of floating types
C2011 6.4 Lexical elements : Examples
C2011 6.4.4.4 Character constants : Examples
C2011 //6.5.6 Additive operators // Example
C2011 Annex L Analyzability //defined
C2011 Annex F.10.3.4 The frexp functions //body
C2011 F.10.3.12 The modf functions // implemented
C2011 F.10.6.1 The ceil functions // Implement
C2011 F.10.6.6 The round functions // Implement
C2011 F.10.7.1 The fmod functions // Implement
関連資料
N1570 typo
C2011 samples using LLVM(Apple Macintosh)
<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>
文書履歴(document history)
ver. 0.01 初稿 20230527
ver. 0.02 ありがとう追記 20230620
最後までおよみいただきありがとうございました。
いいね 💚、フォローをお願いします。
Thank you very much for reading to the last sentence.
Please press the like icon 💚 and follow me for your happy life.