[PATCH] Document arithmetic overflow semantics

Joe Buck jbuck@synopsys.com
Fri Feb 14 18:10:00 GMT 2003


On Fri, Feb 14, 2003 at 08:46:02AM +0100, Marcel Cox wrote:
> I think initializing automatic variables to 0 is the worst you could do as
> you would start helping people write erronous code which relies on
> uninitialized variables being 0.
> If you really want to help people track down problems with uninitialzed
> variables, initialize all variables with some "magic" value which is always
> the same so that you get predictable behaviour, but a value which is useless
> to 99.9% of all programs because it will automatically yield wrong results.

For floating point, a signaling NaN can be used.  For integers,
0xdeadbeef or some such.

[ cases where gcc can't figure out that a variable is uninitialized ]

> > Despite the small cost, this could be a real help to some people...

It should be possible to turn the feature off.



More information about the Gcc-patches mailing list