Results for “overflow”
Small, practical examples. Search by task or narrow things down below.
Calculate a page count without an overflowing addition
C: Divide first and add one only when a nonzero remainder remains.
C✓ Tested
Detect integer addition overflow
Java: Math.addExact throws rather than silently wrapping on overflow.
Java✓ Tested
Detect integer overflow with checked
C#: A checked arithmetic block throws instead of silently wrapping an integer result.
C#✓ Tested
Handle integer overflow without panicking
Handle integer overflow without panicking in a complete Rust program using the standard library.
Rust✓ Tested
Add inner spacing to a content-sized box
CSS: In content-box sizing, padding adds to the declared content width.
CSS✓ Tested
Allow long content to scroll
CSS: Learn how to allow long content to scroll in a complete browser example.
CSS✓ Tested
Cap a box’s width
CSS: Max-width constrains an otherwise larger declared width.
CSS✓ Tested
Check an array allocation size before multiplying
C: Compare the requested element count against SIZE_MAX divided by element size.
C✓ Tested
Check positive integer addition before performing it
C: Check the upper boundary before adding two known nonnegative integers.
C✓ Tested
Clip content that exceeds a fixed-height box
CSS: Overflow hidden clips the painted content while the full content remains in the DOM.
CSS✓ Tested
Enforce a minimum width
CSS: Min-width can prevent a declared smaller width from taking effect.
CSS✓ Tested
Hide an element while keeping its space
CSS: Visibility hidden preserves layout geometry even though the element is not painted.
CSS✓ Tested