I know that uninitialized globals are restored in the BSS segment and the OS should initialize it to zeros.
But it’s should not must,and I’ve never seen any standard saying that uninitialized globals must be default to zeros, so is it safe to take this as granted?
Here’s the autoritative answer from the C99 Standard Document clause 6.7.8 (paragraph 10):
If an object that has automatic storage duration is not initialized explicitly, its value is
indeterminate. If an object that has static storage duration is not initialized explicitly,
then:
rules.