pub struct Wrapping {
pub signed: bool,
pub pointer: bool,
}Expand description
What overflows rather than being undefined, from -fwrapv and its relatives.
C says a signed addition that overflows and a pointer that walks off the end of the object it points into are both undefined, and an optimizer that believes it reads a great deal into every loop: that a counter going up one at a time never turns round, that an index widened to an address may be widened before the arithmetic rather than after, that a bound is reached. These flags withdraw exactly that. They do not make the program mean something else, they make it mean less, and the code that asks for them is code that overflows on purpose and wants the answer the machine gives rather than the answer the standard declines to give.
Two of them because gcc has two, and a build that wants one usually wants the other. Signed arithmetic and pointer arithmetic are separate assumptions and a kernel turns both off.
Fields§
§signed: boolWhether signed arithmetic wraps, from -fwrapv.
pointer: boolWhether pointer arithmetic wraps, from -fwrapv-pointer.