Skip to content
DevMeme
6483 of 7590
EmbeddedSystems Post #7108 · source on Telegram

Embedded Engineers Judge You for Wasting an Entire Int on a Counter

Description

A Simpsons meme using Principal Skinner's 'Pathetic' scene. The top text reads: 'EMBEDDED ENGINEERS WHEN I STORE A 1-10 COUNTER IN AN INT RATHER THAN PACKING IT INTO 4 LEFTOVER BITS IN OTHER VARIABLES'. Skinner looks down dismissively with the caption 'Pathetic.' at the bottom. The meme captures the extreme memory optimization mindset of embedded systems engineers who would never waste 32 bits on a value that only needs 4 bits, preferring to pack data into spare bits of existing variables. The imgflip.com watermark is visible

Comments

23
Anonymous ★ Top Pick An embedded engineer doesn't see unused bits -- they see wasted real estate in a silicon apartment where every bit pays rent
  1. Anonymous ★ Top Pick

    An embedded engineer doesn't see unused bits -- they see wasted real estate in a silicon apartment where every bit pays rent

  2. Anonymous

    Most developers see a 32-bit integer as a number. An embedded engineer sees it as a block of 8 potential four-bit counters for eight different state machines

  3. Anonymous

    On a 32 KB AVR, those 28 wasted bits are like leaving the company jet idling on the tarmac

  4. Anonymous

    The real pathetic part is when you realize the compiler was already packing those bits efficiently, but you spent 3 hours hand-optimizing it anyway, only to discover the MCU has 256KB of RAM you'll never use because management insisted on 'future-proofing' the hardware selection

  5. Anonymous

    Ah yes, the eternal divide between embedded engineers who treat every byte like it's 1975 and the rest of us living in the post-scarcity era of 64GB RAM. While we're casually throwing around 64-bit integers for boolean flags, they're over there playing Tetris with bits, squeezing four counters into a single byte and using the sign bit for error flags. But let's be honest - when your entire program needs to fit in 32KB of flash and you're running on a coin cell battery for five years, suddenly that 'wasteful' int allocation looks less like engineering and more like a war crime. They're not wrong; they're just operating in a parallel universe where malloc() is a four-letter word and the stack overflow isn't a website, it's an actual Tuesday afternoon disaster

  6. Anonymous

    Embedded devs packing bits like it's 1985: 'Why allocate 32 when 4 tortured ones suffice?' Until feature creep demands an actual int - and your flash overflows

  7. Anonymous

    Only in firmware does saving one byte by nibble-packing turn a ++ into a read-modify-write with masks, ISR races, and three lost weekends

  8. Anonymous

    Saving four bytes is noble until the next firmware rev changes the register map and your 4-bit counter straddles two volatile fields - enjoy mask/shift archaeology at 3am

  9. @TheFloofyFloof 11mo

    embedded devs seeing how powerful new embedded chips are

    1. @f0cu53d 11mo

      Noooo

    2. @ZgGPuo8dZef58K6hxxGVj3Z2 11mo

      Bold if you to assume we dare use all. You know maybe we will need those resources later in the future in 10 years. /s

  10. @nwordtech 11mo

    Yeah imagine using a single static var for 3 different things instead of a 8 bit register you have for free

  11. @Art3m_1502 11mo

    The time spent on extracting it from other variable will be more valuable than using extra 16 bits of memory. Btw you can use uint8_t🤓🤓🤓

    1. @ygerlach 11mo

      Packing bits is easy with bitfields: struct mydata { int counterA : 4 = 0; counterB:3 =0; stateFlag :1 = 0; errCounter : 5 = 0; .... }

      1. @Art3m_1502 11mo

        It is still an abstraction, compiler will make it usual bitwise operation code. Though it is really convenient for storing registers of some module

      2. @pyrothefuck 11mo

        wow, how have I never heard about this

  12. @ZgGPuo8dZef58K6hxxGVj3Z2 11mo

    Yea this is absolutely true. We will judge you for using references for single use values too

  13. dev_meme 11mo

    Ага, и потом дебажить это до трёх ночи.

    1. @ZgGPuo8dZef58K6hxxGVj3Z2 11mo

      We dont make mistakes so you wont need to touch it until hardware fails

    2. dev_meme 11mo

      Please, stick to English around devmeme 🙏

  14. @hur7m3 11mo

    yawn

  15. @Saeid025 11mo

    best I can do is using u8

  16. @deadgnom32 11mo

    std::vector<bool>

Use J and K for navigation