> Because I’m a vim user, It took me a very long time to understand where these keybindings come from
libreadline supports a basic vi mode. In bash, `set -o vi` lets you use vim-style editing. It is a lifesaver.
680 karma · joined April 16, 2010
> Because I’m a vim user, It took me a very long time to understand where these keybindings come from
libreadline supports a basic vi mode. In bash, `set -o vi` lets you use vim-style editing. It is a lifesaver.
I'd do kbihelp for the first and k2bdwA for the second.
Chien-Shiung Wu!
> Published in the May 1999 issue of "The C/C++ Users Journal"
find . -type f -exec grep stuff {} \;
will also invoke a new grep process for every file, which can be slow. If you think find is going to return a lot of files, it is often better to use find . -type f -exec grep stuff {} + # note plus sign
which will replace {} with as many filenames as allowed (all correctly quoted, etc). (+2) TX
(+1) CO, FL, MT, NC, OR
(-1) CA, IL, MI, NY, OH, PA, WV
(0) everyone elsehttps://en.cppreference.com/w/cpp/utility/functional/bit_not
Maybe use a vector-of-pointer-to-pair, since we're leaving the map around and we don't really need the vector to own anything.
My suspicion (and naive hope) is that most people would not ignore that case if they knew it was dangerous. But I would expect them to ignore it if they didn't know it existed. Hence this article, I guess, which serves to remind everyone that it can in fact happen and is quite dangerous (due to a potential later interaction with kill).
The "canonical" example people use a lot is std::bad_alloc. Often, there is no point in catching it -- what cleanup or fallback work are you planning to do when you can't even allocate memory?
Of course, silently swallowing exceptions with an empty catch-block is terrible.
> just because the types check out doesn't mean it's free from bugs
That's certainly true in the general case. In fact, the author gives a type-checked-but-wrong example of "we need an Int, so just return zero."
But in some specific cases, as the author writes, "One of those facts we can infer [from a type signature] is often the the only possible implementation." The article demonstrates that "possible" includes "also makes use of all the values available (or else the signature would be simpler)."
But if we use operator new/delete instead of std::malloc the optimization doesn't take place: https://godbolt.org/z/vtxqD2
std::lock_guard<std::mutex>(m); // guard is immediately thrown away
versus the correct std::lock_guard<std::mutex> g(m); // hold mutex til end of scope