4 ms·
Out of that I use m_ for members. But that's about it. It is very helpful when you read lengthy methods code. For actual names I use snake notation. I.e. someth
by shmerl 12y ago
Out of that I use m_ for members. But that's about it. It is very helpful when you read lengthy methods code. For actual names I use snake notation. I.e. something like
int m_some_property;
Type in the name is definitely an overkill.
- danielki 12y agoType in the name is overkill for int or char, but it's useful when you've got multiple levels of pointers. ppszName is a pointer to a pointer to a null-terminated string, whereas pbFoo is a pointer to a byte-array. Both of these are void, but what* they point to is important. Additionally, you can have the pairing of pbFoo with pcbFoo, where pbFoo is a byte array, and pcbFoo is a pointer to the size of pbFoo.
- shmerl 12y agoAll of that can be checked in definition. So there is no need to do that but it can be convenient sometimes. It's a question of balancing how much redundant information you want to put in the name to save looking up the definition. If you deal with some pointer however you better look at definition anyway unless you want to risk getting in trouble, so there is no need to put any of that in the name. Void pointers are a major mess which should be avoided altogether unless there is really no other choice. And putting anything in the name of the void pointer doesn't really prevent it from pointing to something else entirely.