Logo
The USB symbol is Neptune's trident.
  • Home
  • Hot
  • Random
  • Search

Browse

  • AI AI
  • AWS AWS
  • Agile Agile
  • Algorithms Algorithms
  • Android Android
  • Apple Apple
  • Azure Azure
  • Backend Backend
  • Bash Bash
  • C++ C++
  • Cloud Cloud
  • All Categories
As an Amazon Associate ProgrammerHumor.io earns from qualifying purchases.

HTTP 418: I'm a teapot

The server identifies as a teapot now and is on a tea break, brb

HTTP 418: I'm a teapot

The server identifies as a teapot now and is on a tea break, brb

Unsigned-byte Memes

Posts tagged with Unsigned-byte

Don't Grow Older Than 255 Or Else It Will Overflow

Programming Algorithms Math
8 months ago 528.0K views 0 shares
Don't Grow Older Than 255 Or Else It Will Overflow
Someone's birthday cake just demonstrated the classic unsigned 8-bit integer overflow problem. They're celebrating their "17th" birthday, but with 256 candles arranged in binary format (well, sort of). The joke? If you store age as an unsigned byte (0-255), hitting 256 wraps you back to 0. So technically, they just became a newborn again. The candles are arranged in what looks like binary representation: 8 candles for 8 bits. Two are lit (representing 1s) and the rest are unlit (representing 0s). The person who made this cake either has a computer science degree or really wanted to avoid buying 256 individual candles. Smart optimization if you ask me—O(1) space complexity instead of O(n). Pro tip: Always use a 64-bit integer for age storage. You'll be safe until someone turns 18,446,744,073,709,551,616 years old, at which point integer overflow is the least of humanity's concerns.

Today's picks

Mini ITX PC Case, Small Form Factor Computer Case, Support SFX/SFX-L PSU, HDD/SSD Drive Bays & 2 Fans Position Compatible, Portable ITX Gaming Case with Removable Handle - Black

Mini ITX PC Case, Small Form Factor Computer Case, Support SFX/SFX-L PSU, HDD/SSD Drive Bays & 2 Fans Position Compatible, Portable ITX Gaming Case with Removable Handle - Black

Affiliate
$64.99
Experts in Programming

Experts in Programming

Programming
115.7K views 4 years ago
Plane-ception: The SQL JSON Cargo Nightmare

Plane-ception: The SQL JSON Cargo Nightmare

Databases
551.2K views 1 year ago