r/programminghorror • u/_giga_sss_ • Apr 10 '26
c++ Getting array indexes that partially match the part variable :P
A program that handles environment variables
42
Upvotes
r/programminghorror • u/_giga_sss_ • Apr 10 '26
A program that handles environment variables
14
u/kleetus_mactavish Apr 10 '26
Just toss it up into the bucket. Like basketball.
10
u/TheBrainStone Apr 11 '26
Intentionally bad code?!
The horror!!!
7
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” Apr 11 '26
Is that throwing when it finds something? Why the fuck isn't the the call to
push_back()inside the if? Why the fuck isn't it using for each?3
u/conundorum Apr 11 '26
This search isn't worth getting nearly so wound up about.
3
u/Zombiesalad1337 Apr 11 '26
If it correctly satisfies the API, who gives a fuck about how its implemented
3
u/Infinite_Self_5782 Apr 11 '26
you're copying the string
i'm gonna cry
3
u/fess89 Apr 11 '26
I didn't even know you could throw/catch int
2
u/Grounds4TheSubstain Apr 11 '26
It has a comment indicating that it was clearly written for a laugh, for whatever reason.
2
u/RichWeekly1332 Apr 15 '26
Returning a vector on the stack it's a coding horror in itself.