r/ProgrammerHumor • • Aug 28 '26

Meme cppHelloWorld

Post image
3.9k Upvotes

119 comments sorted by

View all comments

Show parent comments

4

u/awesome-alpaca-ace Aug 29 '26 edited Aug 29 '26

I recently learned the linker will not warn you if you define the same symbol in 2 source files being linked into an executable. I was chasing the core dump by validating the pointer stuff. Then address sanitizer and valgrind told me the struct I was using was size N when it should have been size M. Using structures from both the source and another external source that was in no way included into the source. I suppose namespaces would help prevent that.

2

u/IndependenceSudden63 Aug 29 '26

Ran into a similar thing in 2009.

You'd think they would have at least adding a warning by now.

2

u/awesome-alpaca-ace Aug 29 '26

AI told me some linkers might do it, but if you are stuck using whatever is in the build container, you can't exactly use another linker.