4 ms·
Many years ago (1990-2005), I remember using C++ and whenever there was an error in some piece of code that involved strings (what should be a basic, fundamenta
by chihuahua 3y ago
Many years ago (1990-2005), I remember using C++ and whenever there was an error in some piece of code that involved strings (what should be a basic, fundamental data type), the error message referred to some complicated template type like std::basic_string<blah blah> and the simplest error was a really long message. It seems that no attention was paid to usability.
- layer8 3y agoC and C++ distinguish between the language and its implementations (compiler plus runtime). Producing good error messages is the compiler's job, not the language's.
- ReactiveJelly 3y agoCool, what apt command installs the C++ spec and not g++?
- bluGill 3y agoClang would be my recommendation. Though once clang showed better error messages were possible g++ cleaned up and things a much better than 15 years ago.
- codethief 3y agoDepending on how the language works and what it allows you to do, your compiler's error messages can only be so helpful, though. I mean, imagine replacing "C and C++" in your message with "Brainfuck". Error messages would be guaranteed to be very low-level, so won't help you solve the actual higher-level problems.
- layer8 3y agoYes, but in the cited example of basic_string, providing useful error messages isn’t actually that hard. It would be more interesting to hear an argument about what specific C++ features make providing useful error messages hard (if indeed they do) for which precise reasons, that would warrant the accusation that the language designers (rather than he compiler writers) didn’t pay attention to usability.
- AlbertCory 3y agoIndeed. And the current generation of error messages is much improved, so clearly it was possible to do better.
- thechao 3y agoFor some unholy, around 2004, reason I wrote a template library that encoded all of the crystallographic groups as integer template arguments; I guess the idea was to allow automated mapping of any point in the unit cell to its canonical cell position. That'd let us compute crystallographic distances in something like O(log n) time, rather than O(n). (The usual way is to copy one of the points to every equivalent point in the unit cell, calculate every distance in all directions, and keep the minimum: 200+ distance calculations in the worst case; the copies were made via sequences of 4x4 matrix multiplies.) Anyways, I deployed this software, and someone had a misstep, and the error message crashed the mainframe. I relayed this story to Bjarne around 2006, and he didn't find it funny — just frustrating.
- hermitcrab 3y ago>the error message crashed the mainframe I remember how horrible templating error messages were in the early days of C++. They still aren't great.
- mianos 3y agoIt is not hugely different today when you have an error in a template. I had a one line error using a boost multi index container. It produced 1300 lines of errors. You do kind of get used to it.