3 ms·
Many of the arguments he gave are mostly just based on the fact that there aren't that much powerful tools around which can do what he requests (and what of cou
by albertzeyer 16y ago
Many of the arguments he gave are mostly just based on the fact that there aren't that much powerful tools around which can do what he requests (and what of course is something you want to have).
Like grepping for all usages of some function. Or getting some code snippet in a way that it comes with all necessary context. Or whatever.
Though, with recent development (particularly on clang), these things may become much more easier. Of course, you will not be able to do magic things (like checking at what places what particular virtual function implementation is called exactly) but it will be trivial to check for example all calls on std::string::size etc.
In the same way, you could also implement some small helper tool for sharing code snippets which will add some meta information about the context. So that when you share some code like 'a += "foo";' it will contain the meta information that a is an std::string.
LLVM/clang is anyway also kind of a disprove to his arguments about maintainability. I would say that one reason that working on/with the LLVM/clang code is so much nicer compared to working on/with the GCC code is because it is written in C++.
- acqq 16y agoYou're wrong. I've actually had to maintain the big C++ projects. That have Zillion of classes, fully different, but each one has more Read(), Write() functions. Some are virtual, some are not. Some have two parameters, some have three, some four. And they even do fully different stuff! Which Read() will be called depends on anything and everything. I claim you just can't figure out what some piece of code does in any other way than by actually single-stepping through the debug build. Any time the debug build pieces of code don't reflect the source, you're fully lost. Note that Linus usage scenario is "read the chunk of code outside of the whole source base" and you argumenting "if I use some hypotetical very clever tool the tool would maybe able to show me what some line in the chunk of code actually does." I've actually made some "very clever tools" since some twenty years ago. And I wouldn't want to have to use them on the really big projects.
- albertzeyer 16y agoWhat exactly is your point? You have the same problem if you use virtual function tables in C.
- albertzeyer 16y agoBtw., I was describing basically two tools: 1. Some replacement for grep to search through the code. Where you can search for "std::string::size()" or sth like this and it will show you exactly all calls to that function. This tool is really trivial to implement. (Probably someone has done that already.) 2. Some tool which adds some metadata to a code snippet. Which would just add exactly those information of the context which is needed to understand the snippet. I.e. this fully depends on your code. If it is bad code with full of macros, many operator overloadings and other tricks, there will be a lot of context around, otherwise, not.