Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7349,16 +7349,18 @@
object \tcode{obj2} potentially requiring dynamic initialization and defined
later in the same translation unit, it is unspecified whether the value of \tcode{obj2} used
will be the value of the fully initialized \tcode{obj2} (because \tcode{obj2} was statically
initialized) or will be the value of \tcode{obj2} merely zero-initialized. For example,
initialized) or will be the value of \tcode{obj2} merely zero-initialized. For example:
\begin{codeblock}
inline double fd() { return 1.0; }
extern double d1;
double d2 = d1; // unspecified:
// either statically initialized to \tcode{0.0} or
// dynamically initialized to \tcode{0.0} if \tcode{d1} is
// dynamically initialized, or \tcode{1.0} otherwise
double d1 = fd(); // either initialized statically or dynamically to \tcode{1.0}
double d2 = d1;
double d1 = fd();
\end{codeblock}
Both \tcode{d1} and \tcode {d2} can be initialized
either statically or dynamically.
If \tcode{d1} is initialized statically and \tcode{d2} dynamically,
both variables are initialized to \tcode{1.0};
in all other cases, \tcode{d2} is initialized to \tcode{0.0}.
\end{note}

\rSec3[basic.start.dynamic]{Dynamic initialization of non-block variables}
Expand Down