memesearch
C++ String Size 42

C++ String Size 42

Download Find similar pictures
Text on the meme
#include <vector> #include <iostream> #include <string> int main() { std::string s; s[-8] = 42; std::cout << "size" << s.size(); } ASM generation compiler returned: 0 Execution build compiler returned: 0 Program returned: 0 size 42
What it means

A C++ program writes to a wildly invalid negative index of an empty string, yet the compiler and runtime appear to succeed and report “size 42.” The joke is about undefined behavior producing an absurdly confident result, so it is used as a reaction to bizarre programming bugs or impossible outcomes. EN: A C++ program writes to a wildly invalid negative index of an empty string, yet the compiler and runtime appear to succeed and report “size 42.” The joke is about undefined behavior producing an absurdly confident result, so it is used as a reaction to bizarre programming bugs or impossible outcomes.

Objects
Tags
Sources
Type
image
Size
800×711 · 65.1 KiB
Mood
absurd, sarcastic
Language
en
Added