[C\+\+ Core Guidelines: The Rules for in, out, in\-out, consume, and forward Function Parameter \- ModernesCpp\.com](https://www.modernescpp.com/index.php/c-core-guidelines-how-to-pass-function-parameters)
[syntax \- Why do people use \_\_ \(double underscore\) so much in C\+\+ \- Stack Overflow](https://stackoverflow.com/questions/224397/why-do-people-use-double-underscore-so-much-in-c)
[c\+\+ \- ":" \(colon\) in C struct \- what does it mean? \- Stack Overflow](https://stackoverflow.com/questions/8564532/colon-in-c-struct-what-does-it-mean)
[c\+\+ \- why destructor is not called implicitly in placement new"? \- Stack Overflow](https://stackoverflow.com/questions/1022320/why-destructor-is-not-called-implicitly-in-placement-new)
> A very common implementation-defined form of main() has a third argument (in addition to argc and argv), of type char*[], pointing at an array of pointers to the execution environment variables.
`envp`は処理系定義
``` cpp
intmain(intargc,char*argv[],char*envp[]){}
```
FYI: [\`main\` function and command-line arguments (C++) | Microsoft Docs](https://docs.microsoft.com/en-us/cpp/cpp/main-function-command-line-args?view=msvc-170#the-envp-command-line-argument)
*[c\+\+ \- Error handling in std::ofstream while writing data \- Stack Overflow](https://stackoverflow.com/questions/28342660/error-handling-in-stdofstream-while-writing-data)
[c\+\+11 \- std::ostream to file or standard output \- Stack Overflow](https://stackoverflow.com/questions/23345504/stdostream-to-file-or-standard-output)
[c\+\+ \- Where does the time from \`std::chrono::system\_clock::now\(\)\.time\_since\_epoch\(\)\` come from and can it block if accessed from multiple threads? \- Stack Overflow](https://stackoverflow.com/questions/46740302/where-does-the-time-from-stdchronosystem-clocknow-time-since-epoch-c/46740824#46740824)
> A typical C++ standard library implementation would rely on the underlying OS system call to get the actual system clock value to construct the time_point object.
[gcc/chrono\.cc at master · gcc\-mirror/gcc](https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/src/c%2B%2B11/chrono.cc#L80)
*[c\+\+ \- Including \#includes in header file vs source file \- Stack Overflow](https://stackoverflow.com/questions/2596449/including-includes-in-header-file-vs-source-file/2596554)
*[include\-what\-you\-use/include\-what\-you\-use: A tool for use with clang to analyze \#includes in C and C\+\+ source files](https://github.com/include-what-you-use/include-what-you-use)
// error: initializer for flexible array member ‘const char* Hoge::ng_list []’
constchar*ng_list[]={"ab","cd","ef","gh","ij"};
};
```
*[c \- How to initialize a structure with flexible array member \- Stack Overflow](https://stackoverflow.com/questions/8687671/how-to-initialize-a-structure-with-flexible-array-member)
*[C言語のフレキシブル配列メンバ(flexible array member)、通称struct hack \| NO MORE\! 車輪の再発明](https://mem-archive.com/2018/08/10/post-529/)
* あくまでCの構文?
### `std::atomic`の初期値
*[c\+\+ \- What's the default value for a std::atomic? \- Stack Overflow](https://stackoverflow.com/questions/36320008/whats-the-default-value-for-a-stdatomic)
> For every named variable with static or thread-local storage duration that is not subject to constant initialization, before any other initialization.
*`detail`: [tinyformat/tinyformat\.h at master · c42f/tinyformat](https://github.com/c42f/tinyformat/blob/master/tinyformat.h#L181)
*`detail`, `impl`: boost header
* 標準ライブラリは`std::__detail::`を利用している
## 文字列
### `std::string(nullptr)`は違反
[c\+\+ \- Assign a nullptr to a std::string is safe? \- Stack Overflow](https://stackoverflow.com/questions/10771864/assign-a-nullptr-to-a-stdstring-is-safe)
### null文字の扱い
*[serial port \- does read\(\) in c read null character \- Stack Overflow](https://stackoverflow.com/questions/50625105/does-read-in-c-read-null-character)
*[c\+\+ \- Copy string data with NULL character inside string to char array \- Stack Overflow](https://stackoverflow.com/questions/22907430/copy-string-data-with-null-character-inside-string-to-char-array)
[documentation \- Is that an in or in/out parameter? Doxygen, C\+\+ \- Stack Overflow](https://stackoverflow.com/questions/47732665/is-that-an-in-or-in-out-parameter-doxygen-c)
*[c++ - Why std::hash\<int> seems to be identity function - Stack Overflow](https://stackoverflow.com/questions/38304877/why-stdhashint-seems-to-be-identity-function)
*[c++ - hash value of int is the same number - Stack Overflow](https://stackoverflow.com/questions/19734875/hash-value-of-int-is-the-same-number)
*[How to read a file from disk to std::vector\<uint8\_t> in C\+\+](https://gist.github.com/looopTools/64edd6f0be3067971e0595e1e4328cbc)
*[c++ - How to read a binary file into a vector of unsigned chars - Stack Overflow](https://stackoverflow.com/questions/15138353/how-to-read-a-binary-file-into-a-vector-of-unsigned-chars)
*[c\+\+ \- Getting a bunch of crosses initialization error \- Stack Overflow](https://stackoverflow.com/questions/11578936/getting-a-bunch-of-crosses-initialization-error/11578973)
*[c\+\+ \- What are the signs of crosses initialization? \- Stack Overflow](https://stackoverflow.com/questions/2392655/what-are-the-signs-of-crosses-initialization)
## 実行時(共有ライブラリのロード時)に`undefined symbol: _ZTI8XXXClass(typeinfo for XXXClass)`
``` cpp
classXXXClass{
virtualvoidfoo()=0;
};
```
ここで`=0`としない場合は実体を定義する必要がある
ビルドは問題なく通り、実行時に発覚することが問題点
たしかに、共有ライブラリを`nm`コマンドで見てみると`U`となっている
*[c\+\+ \- What is an undefined reference/unresolved external symbol error and how do I fix it? \- Stack Overflow](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix)
*[Undefined symbols for architecture x86\_64:の原因(複数) \| MaryCore](https://marycore.jp/prog/xcode/undefined-symbols-for-architecture-x86-64/)
[C\+\+ Core Guidelines: The Rules for in, out, in\-out, consume, and forward Function Parameter \- ModernesCpp\.com](https://www.modernescpp.com/index.php/c-core-guidelines-how-to-pass-function-parameters)
[syntax \- Why do people use \_\_ \(double underscore\) so much in C\+\+ \- Stack Overflow](https://stackoverflow.com/questions/224397/why-do-people-use-double-underscore-so-much-in-c)
[c\+\+ \- ":" \(colon\) in C struct \- what does it mean? \- Stack Overflow](https://stackoverflow.com/questions/8564532/colon-in-c-struct-what-does-it-mean)
[c\+\+ \- why destructor is not called implicitly in placement new"? \- Stack Overflow](https://stackoverflow.com/questions/1022320/why-destructor-is-not-called-implicitly-in-placement-new)
> A very common implementation-defined form of main() has a third argument (in addition to argc and argv), of type char*[], pointing at an array of pointers to the execution environment variables.
`envp`は処理系定義
``` cpp
intmain(intargc,char*argv[],char*envp[]){}
```
FYI: [\`main\` function and command-line arguments (C++) | Microsoft Docs](https://docs.microsoft.com/en-us/cpp/cpp/main-function-command-line-args?view=msvc-170#the-envp-command-line-argument)
*[c\+\+ \- Error handling in std::ofstream while writing data \- Stack Overflow](https://stackoverflow.com/questions/28342660/error-handling-in-stdofstream-while-writing-data)
[c\+\+11 \- std::ostream to file or standard output \- Stack Overflow](https://stackoverflow.com/questions/23345504/stdostream-to-file-or-standard-output)
[c\+\+ \- Where does the time from \`std::chrono::system\_clock::now\(\)\.time\_since\_epoch\(\)\` come from and can it block if accessed from multiple threads? \- Stack Overflow](https://stackoverflow.com/questions/46740302/where-does-the-time-from-stdchronosystem-clocknow-time-since-epoch-c/46740824#46740824)
> A typical C++ standard library implementation would rely on the underlying OS system call to get the actual system clock value to construct the time_point object.
[gcc/chrono\.cc at master · gcc\-mirror/gcc](https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/src/c%2B%2B11/chrono.cc#L80)
*[c\+\+ \- Including \#includes in header file vs source file \- Stack Overflow](https://stackoverflow.com/questions/2596449/including-includes-in-header-file-vs-source-file/2596554)
*[include\-what\-you\-use/include\-what\-you\-use: A tool for use with clang to analyze \#includes in C and C\+\+ source files](https://github.com/include-what-you-use/include-what-you-use)
// error: initializer for flexible array member ‘const char* Hoge::ng_list []’
constchar*ng_list[]={"ab","cd","ef","gh","ij"};
};
```
*[c \- How to initialize a structure with flexible array member \- Stack Overflow](https://stackoverflow.com/questions/8687671/how-to-initialize-a-structure-with-flexible-array-member)
*[C言語のフレキシブル配列メンバ(flexible array member)、通称struct hack \| NO MORE\! 車輪の再発明](https://mem-archive.com/2018/08/10/post-529/)
* あくまでCの構文?
### `std::atomic`の初期値
*[c\+\+ \- What's the default value for a std::atomic? \- Stack Overflow](https://stackoverflow.com/questions/36320008/whats-the-default-value-for-a-stdatomic)
> For every named variable with static or thread-local storage duration that is not subject to constant initialization, before any other initialization.
*`detail`: [tinyformat/tinyformat\.h at master · c42f/tinyformat](https://github.com/c42f/tinyformat/blob/master/tinyformat.h#L181)
*`detail`, `impl`: boost header
* 標準ライブラリは`std::__detail::`を利用している
## 文字列
### `std::string(nullptr)`は違反
[c\+\+ \- Assign a nullptr to a std::string is safe? \- Stack Overflow](https://stackoverflow.com/questions/10771864/assign-a-nullptr-to-a-stdstring-is-safe)
### null文字の扱い
*[serial port \- does read\(\) in c read null character \- Stack Overflow](https://stackoverflow.com/questions/50625105/does-read-in-c-read-null-character)
*[c\+\+ \- Copy string data with NULL character inside string to char array \- Stack Overflow](https://stackoverflow.com/questions/22907430/copy-string-data-with-null-character-inside-string-to-char-array)
[documentation \- Is that an in or in/out parameter? Doxygen, C\+\+ \- Stack Overflow](https://stackoverflow.com/questions/47732665/is-that-an-in-or-in-out-parameter-doxygen-c)
*[c++ - Why std::hash\<int> seems to be identity function - Stack Overflow](https://stackoverflow.com/questions/38304877/why-stdhashint-seems-to-be-identity-function)
*[c++ - hash value of int is the same number - Stack Overflow](https://stackoverflow.com/questions/19734875/hash-value-of-int-is-the-same-number)
*[How to read a file from disk to std::vector\<uint8\_t> in C\+\+](https://gist.github.com/looopTools/64edd6f0be3067971e0595e1e4328cbc)
*[c++ - How to read a binary file into a vector of unsigned chars - Stack Overflow](https://stackoverflow.com/questions/15138353/how-to-read-a-binary-file-into-a-vector-of-unsigned-chars)
*[c\+\+ \- Getting a bunch of crosses initialization error \- Stack Overflow](https://stackoverflow.com/questions/11578936/getting-a-bunch-of-crosses-initialization-error/11578973)
*[c\+\+ \- What are the signs of crosses initialization? \- Stack Overflow](https://stackoverflow.com/questions/2392655/what-are-the-signs-of-crosses-initialization)
## 実行時(共有ライブラリのロード時)に`undefined symbol: _ZTI8XXXClass(typeinfo for XXXClass)`
``` cpp
classXXXClass{
virtualvoidfoo()=0;
};
```
ここで`=0`としない場合は実体を定義する必要がある
ビルドは問題なく通り、実行時に発覚することが問題点
たしかに、共有ライブラリを`nm`コマンドで見てみると`U`となっている
*[c\+\+ \- What is an undefined reference/unresolved external symbol error and how do I fix it? \- Stack Overflow](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix)
*[Undefined symbols for architecture x86\_64:の原因(複数) \| MaryCore](https://marycore.jp/prog/xcode/undefined-symbols-for-architecture-x86-64/)