309 karma · joined December 8, 2018
Second of all, in a generic C interface keys are likely to be treated as void pointer and almost certainly are going to be moved around with memcpy etc. rather than returned/passed by value since doing so would make the interface non-generic.
struct foo foo_inst; memset(&foo_inst, 0, sizeof(foo_inst));
will certainly result in all padding bytes being set to zero.
EDIT: Based on some of the comments I'm getting here, it seems like some of you have never implemented a hashmap/generic interface in vanilla C and it shows. If you want a hashmap that is generic and you don't want to write/specify a hashing function for keys on map initialization, then what you're likely to end up doing is ensuring that keys are initialized consistently, providing key size on map initialization, and simply performing a hash on the key as though it were a buffer of bytes.
Suggesting that this is somehow any more fragile than anything else in C or that templates should be used instead, which is an absurd comment since templates do not exist in C, is ridiculous. This comment is replying to a comment about how solutions to this problem have existed since K&R C--and they have. You don't need templates to not ignore UB, although if you are using C++ you can certainly use templates (and also take advantage of the stronger type system) to work around issues like this.
The point is that avoiding undefined behavior in C/C++ hashmap implementations is not something that has only recently become possible. C solutions may be more fragile, but that doesn't stop them from being "correct" in that will yield correct behavior unless an error is made elsewhere. Code that makes assumptions about the values of padding without explicitly setting those values is NOT correct and for anyone who works in a language like C/C++ regularly, that should be obvious.
DuckDuckGo supports several other commands like this, which they refer to as "bangs."
I'm not sure having a keyboard layout completely interalized is ever really meaningless. For example, I typed this entire reply on my phone without looking at the keyboard once, based solely on knowledge of the positions of the different keys in relation to one another. Furthermore, even if I had been looking at the keyboard, having memorized the locations of everything in some part of my mind would definitely make it faster to type than if I had no idea where anything was. Besides, if someone were most familiar with a non-Qwerty layout, why wouldn't they just set their phone to that?
The funny thing about both Cygwin and WSL is that, in my experience, many of the people who make use of them wish that they didn't have to make use of them. For me, Cygwin makes it a little easier for me to forget I'm not where I want to be (especially with things like winpty and apt-cyg). In Cygwin I can run URxvt just like at home, and run all the nonsense legacy software I need to for work, just like it were actually reasonable. In WSL, I can do none of that. It just doesn't work. I have a few co-workers who run WSL alongside cmd.exe. If I'm going to have to do that, I'd rather just stick to Cygwin.
Personally, I think I'd be more apt to use the "functional" style.