6 ms·
Today I was again amazed by the simplistic-ness of the description of a linking failure by a c++ compiler/linker. It was complaining about an undefined referenc
by nuancebydefault 4y ago
Today I was again amazed by the simplistic-ness of the description of a linking failure by a c++ compiler/linker. It was complaining about an undefined reference without stating where said reference resided. Compiler makers must hate us developers or think we are intelligent enough to have enough with just half a word.
- mhh__ 4y agoIn general, the linker is written by people different to the people who write the compiler. I don't hate you I just don't control the whole stack. Also linkers can tell you where the symbol was referenced if that place has a location in the code. This isn't universal but it's practically always been there for me.
- nuancebydefault 4y agoThanks for not hating me :p What i also find hard to understand is that generally linkers are "single pass" i.e. you need to feed them objects and libs in the correct order (callers prior to callees) for them to solve all links. Not sure if this requirement still is always there.
- JonChesterfield 4y agoThat requirement vhas been gone for decades if it ever existed, though static library semantics look a bit like that if you don't pass extra flags around them. Linkers are multiple pass if doing compiler optimisation things. Otherwise they're pretty close to cat + patch some pieces, single pass seems fair. It's not immediately obvious to me why linkers don't say which functions were making the undefined symbol call. A suspicion is that the linker may not know what the function name is for the corresponding instruction without digging it out of the debug info and the linker probably doesn't have the corresponding parser ready to hand. It probably could narrow it down to a source object file, though libraries make that difficult.
- WalterBright 4y agoI've written linkers. This one pass thing was gone before the 1980s.
- nuancebydefault 4y agoI've seen it being a problem maybe 10 years ago but i'm happy if it is fully a thing of the past.
- tester756 4y ago>Compiler makers must hate us developers I think that C or C++ were just written by people who never gave a single damn about UX until competition appeared and then things started improving,
- marginalia_nu 4y agoThe abysmal compile time for these languages may also have encouraged this fairly bare-bones UX philosophy.
- tester756 4y ago>fairly bare-bones UX philosophy. What do you mean?
- marcosdumay 4y agoC was created by people that didn't have any extra resource to spend on UX. Just another day there was an article here about emulating the computer C was written for in a RP2040 (the Raspbery Pi "competitor" for the Arduino), and yes, it has plenty of space for that. C++ had more of a choice about it.
- tester756 4y ago>C was created by people that didn't have any extra resource to spend on UX How many years have passed since that time?
- marcosdumay 4y agoOh, enough to improve things several times (to answer, 5 decades). People did some improvements, but clearly didn't keep-up with the times (and degraded some things too, UB being the elephant in the room). But large things almost never keep-up with the times.
- nuancebydefault 4y ago