T O P I C R E V I E W |
znakeeye |
Posted - Jan 07 2008 : 04:14:23 AM I don't know how many times I write this a day:
CSomeClass someClass;
Wouldn't it be great if there was some fast "Declare a variable of this type, with a decent name"-function? I think there should be something like Ctrl+Enter that does things like this (I'm using acronyms here): Cmycs Ctrl+Enter yields: CMyClass myClass;\\n usig Ctrl+Enter yields: unsigned int i;\\n
The variable name should then be selected to let the user decide whether it should be changed or not.
Regarding class instances, I believe the best solution is to remove any leading 'C' and then make the first character lower case. For basic types I guess this is a good trade-off: char => c long/int => i other => var
An extension would be to allow Ctrl+Enter after an asterisk, and insert the following: CMyClass* Ctrl+Enter yields: CMyClass *pMyClass = new CMyClass(|); int* Ctrl+Enter yields: int *pVar = new int[|];
Feline, what you say? High five?  |
1 L A T E S T R E P L I E S (Newest First) |
feline |
Posted - Jan 07 2008 : 2:13:24 PM I do see the appeal, but I can also feel an "enthusiastic discussion" (someone will want me lynched if we do that ) coming on from people who want different naming conventions.
A couple of obvious edge cases: * class member variables. often these start with "m_" or "_" * 6 variables in a row of the same type
While testing things I often end up with similar names, but for real world code at least half my variables have "better" names that are more descriptive.
A lot of people hate the idea of using the type as part of the variable name. Personally I find this helpful, especially when working in a scripting language, but again it is down to personal preference. |
|
|