4 ms·
> Right click -> Find all references doesn't do that faster than typing out the grep command? Yes, IDE is not generally faster. Find all references is not fast
by vardump 12y ago
> Right click -> Find all references doesn't do that faster than typing out the grep command?
Yes, IDE is not generally faster. Find all references is not faster for me in most real life scenarios. Typing grep command is just arrow up, ctrl-something to get the cursor to right position, type something, hit enter. Piped to less, I hit / to search within the results. Done right, results from grep appear pretty much instantly, no waiting. Some operating systems are much better for this technique than others, due to cost of dealing with small files.
> You said mutable state makes it harder to understand, and you said exceptions make it harder to understand because they're hidden gotos (which if statements and while loops are too), but didn't explain either. In my experience, exceptions have been a very simple, helpful, intuitive component of control flow.
Whenever you call some method (or overloaded operator), it can throw. The fact is completely hidden from the context in front of you in C++.
In Java, you do know what might throw, because you have to declare it. On the other hand, the cost is high when anything you call changes the exceptions it throws. Or more like, it's set in stone.
- jimmaswell 12y agoThat still sounds like more work than the way I do the same process in Visual Studio, which uses the AST or something around that level to search the code instead of just a text search, so it doesn't find irrelevant results. I guess it depends on your environment. It is better when it's specified exactly what exceptions can be thrown by a method, yes. One of the only things I prefer in Java over C#.
- vardump 12y agoIf only Visual Studio/C++ used AST! At least in Visual Studio 2012/C++, context sensitive search doesn't often work at all. Try to get context for something common like ".create". You get a lot of non-context hits, even thousands. Maybe I'm doing something wrong? Maybe this doesn't happen in VS2013? In most other IDEs context sensitivity is better, but I still fall back to command line in Linux. It's just so much faster (for me). I get what I want in about 0.1 to 3 seconds and can easily search near (grep -A and -B switches) these context hits with '/' in "less". Git grep is great too. Regardless, if it works for you, great. We should all use what works and disregard needless debate and politics.
- jimmaswell 12y agoI haven't used it for C++, only C# and VB.NET. It's integrated more with those, probably not with C++
- taeric 12y agoOne point I often see missed is that having a code base that supports grep style searching often involves a codebase that does not constantly reuse the same function names. With one that is really done this way, the same variable name appearing in multiple places will be informative, as well. Even if the types are different.
- edgyswingset 12y agoIn my experience, VS2013 with peek-at-definition really is unmatched. I'm all for text searches (it's my go-to, rather than point-and-click files), but the contextual definition (and ability to edit) is stellar.
- codygman 12y agoI used to grep everything, but now in emacs I have a "go to definition" for every language I could find it for bound to a hotkey.