Namespaces
Variants
Actions

User:Radix/cpp/language

From cppreference.com

Initialization section refactoring

Initialization

Changes:

  1. ordered and unordered were linking where Dynamic non-local initialization links — drop them as superfluous.
  2. cpp/language/initialization#Dynamic initialization has subsections for early and deferred initialization — add links to them (as a kind of replacement for ordered and unordered).
  3. Make Static non-local initialization and Dynamic non-local initialization link to their respective subsections of the cpp/language/initialization#Non-local variables section, not to the section itself.
  4. The links on initialization of non-local variables take 4 lines — reflow them into 3.
  5. Remove repetition of the word `initialization`.
  6. Capitalize words `zero`, `constant`, `early` and `deferred` to indicate that they (like the other ones) are premodifiers for the word `initialization`.
  7. The lines on syntactic-semantic kinds of initialization take too much space — reflow them from 7 to 3 based on the number of arguments they take (usually):
    1. Default and Value take no arguments;
    2. Copy and Reference take one argument;
    3. Direct, Aggregate and List take multiple arguments.
I'm on the fence about "Remove repetition of the word `initialization`" - I have a feeling it makes the slightly wrong index a little more wrong. There are different categories of terminology here, some are terms that are always used with a dash ("zero-initialization", "default-initialization", "value-initialization", "copy-initialization", "list-initialization"), others are terms always used with a space ("aggregate initialization", "static initialization", "constant initialization"), others are things we made up ("reference initialization" is not a term, it's just our description of [dcl.init.ref]). On the other hand, the standard index entry for Initialization has entries called "default", "value", and "copy" (but also "list-initialization" and "zero-initialization", it seems they've been a bit sloppy there, too). --Cubbi (talk) 06:27, 14 January 2019 (PST)
I wouldn't say anything is wrong, but I do agree that these "kinds" of initialization are not mutually exclusive nor on the same conceptual level of the language (List and Aggregate mean presence of braces (a syntactic aspect) and Value, Default and Zero are purely about semantic). Regarding dashes and spaces: I don't think they are really that important — they hardly indicate anything about what a given kind of initialization means. More than that, dashes imply that the term is a "syntactic category" ([1]), which a kind of initialization is not. Radix (talk) 14:12, 15 January 2019 (PST)

Alternative layout

This one can be explained like that:

  1. Zero-initialization, default-initialization and value-initialization have purely semantic meaning (describe what value (if any) an entity will have).
  2. Copy-initialization and direct-initialization are contexts [2].
  3. Aggregate initialization and list-initialization are syntactically similar — a list of clauses inside braces.
  4. "Reference initialization" is (as Cubbi has noted) a made up term on this wiki.

Notice, that zero-initialization is mentioned twice now. That's because it's concerned both with how and when the initialization happens.

To save space, it might be a good idea to put Reference along Copy and Direct. Radix (talk) 02:11, 20 January 2019 (PST)