I know some POD variables are initialized by default to a meaningful value but others are not. (POD types include int, float, pointers, unions, arrays of POD types, structs of POD types, etc.)
How does scope and storage class affect initialization of POD types?
Specifically, which of the following will be initialized implicitly to a known value (e.g., 0 for integer types) (i.e., value initialization) and which are defined with an indeterminate value (i.e., default initialization):
- Local variables with automatic storage
- Static local variables
- Static global variables
- External variables
- Variables allocated with
new - POD members of a class (without explicit initialization in a constructor)
I know there are existing questions relating to some of these situations, but none comprehensive (they only address specific situations).