In C++, plain-old-data (POD) local variables are uninitialized by default. I've noticed, though, that this leads to bugs, since attempting to read the value of an uninitialized variable is undefined behavior.

Is there a way to force the compiler to automatically initialize all local variables? Perhaps a compiler that has this feature built in, or a compiler switch for one of the common compilers, like GCC or Clang? I would be fine with a Gnu extension; it doesn't have to be standard.

I would expect the variables to be default-initialized, meaning that an `int` would be set to 0.

I am bored with assigning all local `int`s and private class fields to 0.