はじめに(Introduction)
N3054 Working Draft, Standard for Programming Language C
http://www.open-std.org/jtc1/sc22/wg14/docs/papers/2022/n3054.pdf
C++ nは、ISO/IEC JTC1 SC22 WG14の作業原案(Working Draft)です。
公式のISO/IEC 9899原本ではありません。
ISO/IEC JTC1 SC22 のWG14を含むいくつかのWGでは、可能な限り作業文書を公開し、幅広い意見を求めています。
ISO/IEC JTC1 SC7からISO/IEC JTC1 SC22リエゾンとして、2000年頃、C/C++の品質向上に貢献しようとした活動をしていたことがあります。その頃は、まだISO/IEC TS 17961の原案が出る前です。Cの精神が優勢で、セキュリティ対策は補助的な位置付けでした。ISO/IEC TS 17961の制定と、C/C++のライブラリ類の見直しと、C++の進化はどんどん進んでいきます。
進化の具合が、どちらに行こうとしているかは、コンパイルて実行させてみないとわかりません。C/C++の規格案の電子ファイルは、そのままコンパイルできる形式であるとよいと主張してきました。MISRA-C/C++, CERTC/C++でも同様です。MISRA-C/C++は、Example Suiteという形で、コード断片をコンパイルできる形で提供するようになりました。
一連の記事はコード断片をコンパイルできる形にする方法を検討してコンパイル、リンク、実行して、規格案の原文と処理系(gcc, clang)との違いを確認し、技術内容を検討し、ISO/IEC JTC1 SC22 WG21にフィードバックするために用います。
また、CERT C/C++, MISRA C/C++等のコーディング標準のコード断片をコンパイルする際の参考にさせていただこうと考えています。CERT C++, MISRA C++が標準化の動きとの時間的なずれがあれば確認できれば幸いです。また、boostライブラリとの関連、Linux OS, 箱庭プロジェクト、g++(GCC), clang++(LLVM)との関係も調査中です。
何か、抜け漏れ、耳より情報がありましたらおしらせくださると幸いです。
<この項は書きかけです。順次追記します。>
背景(back ground)
C/C++でコンパイルエラーが出ると、途方にくれることがしばしばあります。
何回かに1回は、該当するエラーが検索できます。
ただ、条件が違っていて、そこでの修正方法では目的を達成しないこともしばしばです。いろいろな条件のコンパイルエラーとその対応方法について、広く記録することによって、いつか同じエラーに遭遇した時にやくに立つことを目指しています。
過去に何度か、自分のネットでの記録に助けられたことがあります。
また
https://researchmap.jp/joub9b3my-1797580/#_1797580
に記載したサイトのお世話になっています。
作業方針(sequence)
clangでは--std=c11, -std=C17 -std=c2xの3種類
gccでは-std=c11, -std=C17 -std=c2xの3種類
でコンパイルし、
1)コンパイルエラーを収集する。
2)コンパイルエラーをなくす方法を検討する。
コンパイルエラーになる例を示すだけが目的のコードは、コンパイルエラーをなくすのではなく、コンパイルエラーの種類を収集するだけにする。
文法を示すのが目的のコード場合に、コンパイルエラーをなくすのに手間がかかる場合は、順次作業します。
3)リンクエラーをなくす方法を検討する。
文法を示すのが目的のコード場合に、リンクエラーをなくすのに手間がかかる場合は、順次作業します。
4)意味のある出力を作る。
コンパイル、リンクが通っても、意味のある出力を示そうとすると、コンパイル・リンクエラーが出て収拾できそうにない場合がある。順次作業します。
1)だけのものから4)まで進んだものと色々ある状態です。一歩でも前に進むご助言をお待ちしています。「検討事項」の欄に現状を記録するようにしています。
$ docker run -v /Users/ogawakiyoshi/n4910/n3540:/Users/ogawakiyoshi/n4910/n3540 -it kaizenjapan/n3540 /bin/bash
読書感想文
CコンパイラによるC言語規格の読書感想文として掲載しています。
コンパイル実験が、CN3242に対する、gccとclangによる感想文だということご理解いただけると幸いです。
読書感想文は人間かAIだけが作るものとは限りません。
本(電子書籍を含む)を入力として、その内容に対する文字列を読書感想文として受け止めましょう。
元の文章をあり方、コンパイルできるように電子化しておくこと、コンパイラが解釈可能な断片の作り方など。
個人開発
Cコンパイラの試験を一人でもくもくとやっているのは個人開発の一つの姿です。
<この項は書きかけです。順次追記します。>
編纂器(Compiler)
clang --version
Debian clang version 14.0.6-++20220622053050+f28c006a5895-1~exp1~20220622173135.152
Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin
gcc --version
gcc (GCC) 12.1.0 Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
6.9 External definitions, CN3054:2022 (11) p159.c
算譜(source code)
// CN3054 Committee Draft, Standard for Programming Language C
// http://www.open-std.org/jtc1/sc22/wg14/docs/papers/2022/n3054.pdf
const char * n3054 = "6.9 External definitions, CN3054:2022 (11) p159.c";
// Debian clang version 14.0.5-++20220610033153+c12386ae247c-
// g++ (GCC) 12.1.0 Copyright (C) 2022 Free Software Foundation, Inc.
// Edited by Dr. OGAWA Kiyoshi. Compile procedure and results record.
// C++N3054:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list
#include "N3054.h"
// 6.9.1 Function definitions
// Syntax
// function-definition:
// attribute-specifier-sequenceopt declaration-specifiers declarator function-body
// function-body:
// Constraints
// compound-statement
// The identifier declared in a function definition (which is the name of the function) shall have a function type, as specified by the declarator portion of the function definition.
// The return type of a function shall be void or a complete object type other than array type.
// 203)Thus, if an identifier declared with external linkage is not used in an expression, there need be no external definition for it.
// The storage-class specifier, if any, in the declaration specifiers shall be either extern or static.
// If the parameter list consists of a single parameter of type void, the parameter declarator shall not include an identifier.
// Semantics
// The optional attribute specifier sequence in a function definition appertains to the function.
// The declarator in a function definition specifies the name of the function being defined and the types (and optionally the names) of all the parameters; the declarator also serves as a function prototype for later calls to the same function in the same translation unit. The type of each parameter is adjusted as described in 6.7.6.3.
// If a function that accepts a variable number of arguments is defined without a parameter type list that ends with the ellipsis notation, the behavior is undefined.
// The parameter type list, the attribute specifier sequence of the declarator that follows the parameter type list, and the compound statement of the function body form a single block.204) Each parameter has automatic storage duration; its identifier, if any205), is an lvalue.206) The layout of the storage for parameters is unspecified.
// On entry to the function, the size expressions of each variably modified parameter are evaluated and the value of each argument expression is converted to the type of the corresponding parameter as if by assignment. (Array expressions and function designators as arguments were converted to pointers before the call.)
// After all parameters have been assigned, the compound statement of the function body is executed.
// Unless otherwise specified, if the } that terminates the function body is reached, and the value of the function call is used by the caller, the behavior is undefined.
// NOTE 1 In a function definition, the type of the function and its prototype cannot be inherited from a typedef:
typedef int F(void);
F f, g;
F f { /* ... */ }
F g() { /* ... */ }
int f(void) { /* ... */ }
int g() { /* ... */ }
F *e(void) { /* ... */ }
F *((e))(void) { /* ... */ }
int (*fp)(void);
F *Fp;
// type F is "function with no parameters // returning int"
// f and g both have type compatible with F // WRONG: syntax/constraint error
// WRONG: declares that g returns a function // RIGHT: f has type compatible with F
// RIGHT: g has type compatible with F
// e returns a pointer to a function
// same: parentheses irrelevant
// fp points to a function that has type F // Fp points to a function that has type F
// EXAMPLE 1 In the following:
//extern is thestorage-class specifier and int is the type specifier;
// max(int a, int b) is the function declarator; and
// {returna > b?a:b;}
// 204)The visibility scope of a parameter in a function definition starts when its declaration is completed, extends to following parameter declarations, to possible attributes that follow the parameter type list, and then to the entire function body. The lifetime of each instance of a parameter starts when the declaration is evaluated starting a call and ends when that call terminates.
// 205)A parameter that has no declared name is inaccessible within the function body.
// 206)A parameter identifier cannot be redeclared in the function body except in an enclosed block.
extern int max(int a, int b) {
returna > b?a:b;
}
// EXAMPLE 2 To pass one function to another, one might say
// Then the definition of g might read or, equivalently,
// 6.9.2 External object definitions
// Semantics
int f2(void); /* ... */ g2(f2);
void g2(int (*funcp)(void)) {
/* ... */
(*funcp)(); /* or funcp(); ...*/
}
void g2(int func(void)) {
/* ... */
func(); /* or (*func)(); ...*/
}
// If the declaration of an identifier for an object has file scope and an initializer, the declaration is an external definition for the identifier.
// A declaration of an identifier for an object that has file scope without an initializer, and without a storage-class specifier or with the storage-class specifier static, constitutes a tentative definition. If a translation unit contains one or more tentative definitions for an identifier, and the translation unit contains no external definition for that identifier, then the behavior is exactly as if the translation unit contains a file scope declaration of that identifier, with the composite type as of the end of the translation unit, with an initializer equal to { 0 }.
// If the declaration of an identifier for an object is a tentative definition and has internal linkage, the declared type shall not be an incomplete type.
int i1 = 1; // definition, external linkage
static int i2 = 2; // definition, internal linkage
extern int i3 = 3; // definition, external linkage
int i4;
static int i5;
int i1;
int i2;
int i3;
int i4;
int i5;
extern int i1;
extern int i2;
extern int i3;
extern int i4;
extern int i5;
// tentative definition, external linkage // tentative definition, internal linkage
// valid tentative definition, refers to previous // 6.2.2 renders undefined, linkage disagreement // valid tentative definition, refers to previous // valid tentative definition, refers to previous // 6.2.2 renders undefined, linkage disagreement
// refers to previous, whose linkage is external // refers to previous, whose linkage is internal // refers to previous, whose linkage is external // refers to previous, whose linkage is external // refers to previous, whose linkage is internal
// EXAMPLE 2 If at the end of the translation unit containing
int i[];
// the array i still has incomplete type, the implicit initializer causes it to have one element, which is set to zero on program startup.
int main() {
// PR3(st.a,st.b,st.c,d);
printf("%s\n", n3054);
return EXIT_SUCCESS;
}
編纂・実行結果(compile and go)
$ clang p159.c -std=11 -o p159l -I. -Wall
p159.c:34:4: error: expected ';' after top level declarator
F f { /* ... */ }
^
;
p159.c:57:7: error: use of undeclared identifier 'returna'
returna > b?a:b;
^
p159.c:63:34: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
int f2(void); /* ... */ g2(f2);
^
p159.c:63:37: error: a parameter list without types is only allowed in a function definition
int f2(void); /* ... */ g2(f2);
^
p159.c:77:12: warning: 'extern' variable has an initializer [-Wextern-initializer]
extern int i3 = 3; // definition, external linkage
^
p159.c:80:13: error: non-static declaration of 'i2' follows static declaration
int i1; int i2; int i3; int i4; int i5;
^
p159.c:76:12: note: previous definition is here
static int i2 = 2; // definition, internal linkage
^
p159.c:80:37: error: non-static declaration of 'i5' follows static declaration
int i1; int i2; int i3; int i4; int i5;
^
p159.c:79:12: note: previous definition is here
static int i5;
^
p159.c:86:5: warning: tentative array definition assumed to have one element
int i[];
^
3 warnings and 5 errors generated.
$ clang p159.c -std=17 -o p159l -I. -Wall
p159.c:34:4: error: expected ';' after top level declarator
F f { /* ... */ }
^
;
p159.c:57:7: error: use of undeclared identifier 'returna'
returna > b?a:b;
^
p159.c:63:34: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
int f2(void); /* ... */ g2(f2);
^
p159.c:63:37: error: a parameter list without types is only allowed in a function definition
int f2(void); /* ... */ g2(f2);
^
p159.c:77:12: warning: 'extern' variable has an initializer [-Wextern-initializer]
extern int i3 = 3; // definition, external linkage
^
p159.c:80:13: error: non-static declaration of 'i2' follows static declaration
int i1; int i2; int i3; int i4; int i5;
^
p159.c:76:12: note: previous definition is here
static int i2 = 2; // definition, internal linkage
^
p159.c:80:37: error: non-static declaration of 'i5' follows static declaration
int i1; int i2; int i3; int i4; int i5;
^
p159.c:79:12: note: previous definition is here
static int i5;
^
p159.c:86:5: warning: tentative array definition assumed to have one element
int i[];
^
3 warnings and 5 errors generated.
$ clang p159.c -std=2x -o p159l -I. -Wall
p159.c:34:4: error: expected ';' after top level declarator
F f { /* ... */ }
^
;
p159.c:57:7: error: use of undeclared identifier 'returna'
returna > b?a:b;
^
p159.c:63:34: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
int f2(void); /* ... */ g2(f2);
^
p159.c:63:37: error: a parameter list without types is only allowed in a function definition
int f2(void); /* ... */ g2(f2);
^
p159.c:77:12: warning: 'extern' variable has an initializer [-Wextern-initializer]
extern int i3 = 3; // definition, external linkage
^
p159.c:80:13: error: non-static declaration of 'i2' follows static declaration
int i1; int i2; int i3; int i4; int i5;
^
p159.c:76:12: note: previous definition is here
static int i2 = 2; // definition, internal linkage
^
p159.c:80:37: error: non-static declaration of 'i5' follows static declaration
int i1; int i2; int i3; int i4; int i5;
^
p159.c:79:12: note: previous definition is here
static int i5;
^
p159.c:86:5: warning: tentative array definition assumed to have one element
int i[];
^
3 warnings and 5 errors generated.
$ gcc p159.c -std=11 -o p159g -I. -Wall
p159.c:34:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
34 | F f { /* ... */ }
| ^
p159.c:35:3: error: 'g' declared as function returning a function
35 | F g() { /* ... */ }
| ^
p159.c:37:5: error: redefinition of 'g'
37 | int g() { /* ... */ }
| ^
p159.c:35:3: note: previous definition of 'g' with type 'F' {aka 'int(void)'}
35 | F g() { /* ... */ }
| ^
p159.c:39:6: error: redefinition of 'e'
39 | F *((e))(void) { /* ... */ }
| ^
p159.c:38:4: note: previous definition of 'e' with type 'int (*(void))(void)'
38 | F *e(void) { /* ... */ }
| ^
p159.c: In function 'max':
p159.c:57:7: error: 'returna' undeclared (first use in this function)
57 | returna > b?a:b;
| ^~~~~~~
p159.c:57:7: note: each undeclared identifier is reported only once for each function it appears in
p159.c: At top level:
p159.c:63:34: warning: data definition has no type or storage class
63 | int f2(void); /* ... */ g2(f2);
| ^~
p159.c:63:34: warning: type defaults to 'int' in declaration of 'g2' [-Wimplicit-int]
p159.c:63:10: warning: parameter names (without types) in function declaration
63 | int f2(void); /* ... */ g2(f2);
| ^~~
p159.c:64:27: error: conflicting types for 'g2'; have 'void(int (*)(void))'
64 | void g2(int (*funcp)(void)) {
| ^~
p159.c:63:34: note: previous declaration of 'g2' with type 'int()'
63 | int f2(void); /* ... */ g2(f2);
| ^~
p159.c:68:19: error: conflicting types for 'g2'; have 'void(int (*)(void))'
68 | void g2(int func(void)) {
| ^~
p159.c:63:34: note: previous declaration of 'g2' with type 'int()'
63 | int f2(void); /* ... */ g2(f2);
| ^~
p159.c:77:12: warning: 'i3' initialized and declared 'extern'
77 | extern int i3 = 3; // definition, external linkage
| ^~
p159.c:80:13: error: non-static declaration of 'i2' follows static declaration
80 | int i1; int i2; int i3; int i4; int i5;
| ^~
p159.c:76:12: note: previous definition of 'i2' with type 'int'
76 | static int i2 = 2; // definition, internal linkage
| ^~
p159.c:80:37: error: non-static declaration of 'i5' follows static declaration
80 | int i1; int i2; int i3; int i4; int i5;
| ^~
p159.c:79:12: note: previous declaration of 'i5' with type 'int'
79 | static int i5;
| ^~
p159.c:86:5: warning: array 'i' assumed to have one element
86 | int i[];
| ^
p159.c: In function 'f':
p159.c:36:25: warning: control reaches end of non-void function [-Wreturn-type]
36 | int f(void) { /* ... */ }
| ^
p159.c: In function 'g':
p159.c:37:21: warning: control reaches end of non-void function [-Wreturn-type]
37 | int g() { /* ... */ }
| ^
p159.c: In function 'e':
p159.c:39:28: warning: control reaches end of non-void function [-Wreturn-type]
39 | F *((e))(void) { /* ... */ }
| ^
p159.c: In function 'max':
p159.c:58:4: warning: control reaches end of non-void function [-Wreturn-type]
58 | }
| ^
p159.c: At top level:
p159.c:79:12: warning: 'i5' defined but not used [-Wunused-variable]
79 | static int i5;
| ^~
p159.c:76:12: warning: 'i2' defined but not used [-Wunused-variable]
76 | static int i2 = 2; // definition, internal linkage
| ^~
$ gcc p159.c -std=c17 -o p159g -I. -Wall
p159.c:34:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
34 | F f { /* ... */ }
| ^
p159.c:35:3: error: 'g' declared as function returning a function
35 | F g() { /* ... */ }
| ^
p159.c:37:5: error: redefinition of 'g'
37 | int g() { /* ... */ }
| ^
p159.c:35:3: note: previous definition of 'g' with type 'F' {aka 'int(void)'}
35 | F g() { /* ... */ }
| ^
p159.c:39:6: error: redefinition of 'e'
39 | F *((e))(void) { /* ... */ }
| ^
p159.c:38:4: note: previous definition of 'e' with type 'int (*(void))(void)'
38 | F *e(void) { /* ... */ }
| ^
p159.c: In function 'max':
p159.c:57:7: error: 'returna' undeclared (first use in this function)
57 | returna > b?a:b;
| ^~~~~~~
p159.c:57:7: note: each undeclared identifier is reported only once for each function it appears in
p159.c: At top level:
p159.c:63:34: warning: data definition has no type or storage class
63 | int f2(void); /* ... */ g2(f2);
| ^~
p159.c:63:34: warning: type defaults to 'int' in declaration of 'g2' [-Wimplicit-int]
p159.c:63:10: warning: parameter names (without types) in function declaration
63 | int f2(void); /* ... */ g2(f2);
| ^~~
p159.c:64:27: error: conflicting types for 'g2'; have 'void(int (*)(void))'
64 | void g2(int (*funcp)(void)) {
| ^~
p159.c:63:34: note: previous declaration of 'g2' with type 'int()'
63 | int f2(void); /* ... */ g2(f2);
| ^~
p159.c:68:19: error: conflicting types for 'g2'; have 'void(int (*)(void))'
68 | void g2(int func(void)) {
| ^~
p159.c:63:34: note: previous declaration of 'g2' with type 'int()'
63 | int f2(void); /* ... */ g2(f2);
| ^~
p159.c:77:12: warning: 'i3' initialized and declared 'extern'
77 | extern int i3 = 3; // definition, external linkage
| ^~
p159.c:80:13: error: non-static declaration of 'i2' follows static declaration
80 | int i1; int i2; int i3; int i4; int i5;
| ^~
p159.c:76:12: note: previous definition of 'i2' with type 'int'
76 | static int i2 = 2; // definition, internal linkage
| ^~
p159.c:80:37: error: non-static declaration of 'i5' follows static declaration
80 | int i1; int i2; int i3; int i4; int i5;
| ^~
p159.c:79:12: note: previous declaration of 'i5' with type 'int'
79 | static int i5;
| ^~
p159.c:86:5: warning: array 'i' assumed to have one element
86 | int i[];
| ^
p159.c: In function 'f':
p159.c:36:25: warning: control reaches end of non-void function [-Wreturn-type]
36 | int f(void) { /* ... */ }
| ^
p159.c: In function 'g':
p159.c:37:21: warning: control reaches end of non-void function [-Wreturn-type]
37 | int g() { /* ... */ }
| ^
p159.c: In function 'e':
p159.c:39:28: warning: control reaches end of non-void function [-Wreturn-type]
39 | F *((e))(void) { /* ... */ }
| ^
p159.c: In function 'max':
p159.c:58:4: warning: control reaches end of non-void function [-Wreturn-type]
58 | }
| ^
p159.c: At top level:
p159.c:79:12: warning: 'i5' defined but not used [-Wunused-variable]
79 | static int i5;
| ^~
p159.c:76:12: warning: 'i2' defined but not used [-Wunused-variable]
76 | static int i2 = 2; // definition, internal linkage
| ^~
$ gcc p159.c -std=c2x -o p159g -I. -Wall
p159.c:34:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
34 | F f { /* ... */ }
| ^
p159.c:35:3: error: 'g' declared as function returning a function
35 | F g() { /* ... */ }
| ^
p159.c:37:5: error: redefinition of 'g'
37 | int g() { /* ... */ }
| ^
p159.c:35:3: note: previous definition of 'g' with type 'int(void)'
35 | F g() { /* ... */ }
| ^
p159.c:39:6: error: redefinition of 'e'
39 | F *((e))(void) { /* ... */ }
| ^
p159.c:38:4: note: previous definition of 'e' with type 'int (*(void))(void)'
38 | F *e(void) { /* ... */ }
| ^
p159.c: In function 'max':
p159.c:57:7: error: 'returna' undeclared (first use in this function)
57 | returna > b?a:b;
| ^~~~~~~
p159.c:57:7: note: each undeclared identifier is reported only once for each function it appears in
p159.c: At top level:
p159.c:63:34: warning: data definition has no type or storage class
63 | int f2(void); /* ... */ g2(f2);
| ^~
p159.c:63:34: warning: type defaults to 'int' in declaration of 'g2' [-Wimplicit-int]
p159.c:63:10: warning: parameter names (without types) in function declaration
63 | int f2(void); /* ... */ g2(f2);
| ^~~
p159.c:64:27: error: conflicting types for 'g2'; have 'void(int (*)(void))'
64 | void g2(int (*funcp)(void)) {
| ^~
p159.c:63:34: note: previous declaration of 'g2' with type 'int()'
63 | int f2(void); /* ... */ g2(f2);
| ^~
p159.c:68:19: error: conflicting types for 'g2'; have 'void(int (*)(void))'
68 | void g2(int func(void)) {
| ^~
p159.c:63:34: note: previous declaration of 'g2' with type 'int()'
63 | int f2(void); /* ... */ g2(f2);
| ^~
p159.c:77:12: warning: 'i3' initialized and declared 'extern'
77 | extern int i3 = 3; // definition, external linkage
| ^~
p159.c:80:13: error: non-static declaration of 'i2' follows static declaration
80 | int i1; int i2; int i3; int i4; int i5;
| ^~
p159.c:76:12: note: previous definition of 'i2' with type 'int'
76 | static int i2 = 2; // definition, internal linkage
| ^~
p159.c:80:37: error: non-static declaration of 'i5' follows static declaration
80 | int i1; int i2; int i3; int i4; int i5;
| ^~
p159.c:79:12: note: previous declaration of 'i5' with type 'int'
79 | static int i5;
| ^~
p159.c:86:5: warning: array 'i' assumed to have one element
86 | int i[];
| ^
p159.c: In function 'f':
p159.c:36:25: warning: control reaches end of non-void function [-Wreturn-type]
36 | int f(void) { /* ... */ }
| ^
p159.c: In function 'g':
p159.c:37:21: warning: control reaches end of non-void function [-Wreturn-type]
37 | int g() { /* ... */ }
| ^
p159.c: In function 'e':
p159.c:39:28: warning: control reaches end of non-void function [-Wreturn-type]
39 | F *((e))(void) { /* ... */ }
| ^
p159.c: In function 'max':
p159.c:58:4: warning: control reaches end of non-void function [-Wreturn-type]
58 | }
| ^
p159.c: At top level:
p159.c:79:12: warning: 'i5' defined but not used [-Wunused-variable]
79 | static int i5;
| ^~
p159.c:76:12: warning: 'i2' defined but not used [-Wunused-variable]
76 | static int i2 = 2; // definition, internal linkage
| ^~
検討事項(agenda)
コンパイルエラーを取るか、コンパイルエラーの理由を解説する。
応用例1 MISRA C/C++
MISRA C まとめ #include
https://qiita.com/kaizen_nagoya/items/f1a79a7cbd281607c7c9
MISRA C++ 5-0-16
https://qiita.com/kaizen_nagoya/items/7df2d4e05db724752a74
応用例2 CERT C/C++
SEI CERT C++ Coding Standard AA. Bibliography 確認中。
https://qiita.com/kaizen_nagoya/items/fe06719aef10f3f985ae
MISRA C/C++, AUTOSAR C++, CERT C/C++とC/C++工業標準をコンパイルする
https://qiita.com/kaizen_nagoya/items/8dff19511e42b2593db1
自己参考資料(self reference)
関連する自己参照以外は、こちらの先頭に移転。
C言語(C++)に対する誤解、曲解、無理解、爽快
https://qiita.com/kaizen_nagoya/items/3f3992c9722c1cee2e3a
C2011コンパイル一覧@researchmap
https://researchmap.jp/jownvh0ye-1797580/#_1797580
[C][C++]の国際規格案の例題をコンパイルするときの課題7つ。
https://qiita.com/kaizen_nagoya/items/5f4b155030259497c4de
C Puzzle Bookの有り難み5つ、C言語規格及びCコンパイラの特性を認識
https://qiita.com/kaizen_nagoya/items/d89a48c1536a02ecdec9
dockerにclang
https://qiita.com/kaizen_nagoya/items/8829ffeee397eda50e80
docker gnu(gcc/g++) and llvm(clang/clang++)
https://qiita.com/kaizen_nagoya/items/059874ea39c4de64c0f7
コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)
https://qiita.com/kaizen_nagoya/items/74220c0577a512c2d7da
astyle 使ってみた
https://qiita.com/kaizen_nagoya/items/3c9a87a781d53a1a23f3
<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>
文書履歴(document history)
ver. 0.01 初稿 20221120
最後までおよみいただきありがとうございました。
いいね 💚、フォローをお願いします。
Thank you very much for reading to the last sentence.
Please press the like icon 💚 and follow me for your happy life.