Logo
If debugging removes bugs, programming adds them.
  • 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
9 months ago 549.8K 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

Aula WIN60 HE - 60% Mechanical Gaming Keyboard Wired, Magnetic Switch Hot Swappable, Adjustable Actuation Rapid Trigger Mode, 8000 Hz Polling Rate, RGB Small Keyboard 60 Percent Compact Design for PC

Aula WIN60 HE - 60% Mechanical Gaming Keyboard Wired, Magnetic Switch Hot Swappable, Adjustable Actuation Rapid Trigger Mode, 8000 Hz Polling Rate, RGB Small Keyboard 60 Percent Compact Design for PC

Affiliate
$39.99
Was doing some dynamic malware analysis, and...

Was doing some dynamic malware analysis, and...

Programming
100.5K views 2 years ago
We all know it never happens...

We all know it never happens...

Programming
92.9K views 3 years ago