Remix.run Logo
bluecalm 12 hours ago

It only works for simple variables where initialisation to 0 is counter productive because you lose a useful compiler warning (about using initialised variable).

The main case is about arrays. Here it's often impossible to prove some part of it is used before initialisation. There is no warning. It becomes a tradeoff: potentially costly initialisation (arrays can be very big) or potentially using random values other than 0.

nullc an hour ago | parent [-]

Fair point though compilers could presumably do much better warning there on arrays-- at least treating the whole array like a single variable and warning when it knows you've read it without ever reading for it.