Guest User

Static and dynamic initialization nondeterminism

a guest
Mar 1st, 2014
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. inline double fd() { return 1.0; }
  2.  
  3. extern double d1;
  4.  
  5. double d2 = d1;    // unspecified:
  6.                    // may be statically initialized to 0.0 or
  7.                    // dynamically initialized to 0.0 if d1 is
  8.                    // dynamically initialized, or 1.0 otherwise
  9.  
  10. double d1 = fd();  // may be initialized statically or dynamically to 1.0
Advertisement
Add Comment
Please, Sign In to add comment