- C++相談室 part123 [無断転載禁止]©2ch.net
22 : ◆tAo.kQ2STk [sage]:2016/02/22(月) 08:16:49.84 ID:/YQF/sqY - >>19
チューリング完全である以上は可能だろうけど、リスト方程式とは?
|
- C++相談室 part123 [無断転載禁止]©2ch.net
39 :デフォルトの名無しさん[sage]:2016/02/22(月) 22:56:49.91 ID:/YQF/sqY - >>36
「ゼロ初期化」っていう訳語の専門用語と、「ゼロで初期化する事」は意味が違う。 zero initializationでググると良いよ。
|
- C++相談室 part123 [無断転載禁止]©2ch.net
40 : ◆tAo.kQ2STk [sage]:2016/02/22(月) 22:57:46.65 ID:/YQF/sqY - >>>34
メール受け取ったよ
|
- C++相談室 part123 [無断転載禁止]©2ch.net
43 :デフォルトの名無しさん[sage]:2016/02/22(月) 23:33:38.04 ID:/YQF/sqY - >>42
n3690から抜粋すると 8.5.17:The semantics of initializers are as follows. The destination type is the type of the object or reference being initialized and the source type is the type of the initializer expression. If the initializer is not a single (possibly parenthesized) expression, the source type is not defined. — If the initializer is a (non-parenthesized) braced-init-list, the object or reference is list-initialized 8.5.4.3: List-initialization of an object or reference of type T is defined as follows: if the initializer list has no elements and T is a class type with a default constructor, the object is value-initialized. 8.5.8: To value-initialize an object of type T means: — if T is a (possibly cv-qualified) class type (Clause 9) with either no default constructor (12.1) or a default constructor that is user-provided or deleted, then the object is default-initialized 8.5.7: To default-initialize an object of type T means: — if T is a (possibly cv-qualified) class type (Clause 9), the default constructor (12.1) for T is called つまりこの場合に限ると ・リストで初期化するとlist-initializeされる。 ・リストが空の場合、list-initializeはvalue-initializeになる。 ・デフォルトコンストラクタが削除されてたり、ユーザ定義されてる場合はvalue-initializeはdefault-initializeになる。 ・default-initializeはデフォルトコンストラクタを呼び出す ・hoge::hoge()は何も実行しない→hoge::bakaは未定義のままになる といった具合。 解決するには、 hoge() : baka(0) {return;} みたいにちゃんと初期化コードを書かなきゃ駄目。
|
- C++相談室 part123 [無断転載禁止]©2ch.net
44 :デフォルトの名無しさん[sage]:2016/02/22(月) 23:37:52.25 ID:/YQF/sqY - ちなみにhoge::hoge()を定義しない場合、暗黙のデフォルトコンストラクタが定義されて
その場合はvalue-initializeはzero-initializeになるですよー
|