this post was submitted on 06 Jan 2025
159 points (85.7% liked)

Programmer Humor

19903 readers
1847 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 38 points 2 days ago* (last edited 2 days ago) (1 children)
#include <vector>
#include <algorithm>

int main() {
    int a;
    std::vector<std::vector<int>> v;
    std::vector<std::vector<int>>::const_iterator it = std::find(v.begin(), v.end(), a);
}

assaults you with 42 errors, C++ templates are a joy ๐Ÿ˜Š

[โ€“] [email protected] 7 points 1 day ago (1 children)

But like...what's the real bug?

[โ€“] [email protected] 14 points 1 day ago

Uninitalized memory (int a; with no assignment) vector of int vectors (IE a dynamic int[][]) and attempting to find a, an int in the vector of vectors of int IE int instead of vector<int>. I think the iterator type is correct but I'm not sure off the top of my head