This may be an excellent guide for every programmer annoyed by the rules and recommendations.
How To Write Unmaintainable Code
:)
Printable View
This may be an excellent guide for every programmer annoyed by the rules and recommendations.
How To Write Unmaintainable Code
:)
Thanks for the laugh and I don't mean the link, I mean the argument you just tried to pass.Quote:
Originally Posted by ovidiucucu
Well, generally everything is A or An.Quote:
Originally Posted by TheCPUWizard
My boss (as at least I know) does not read this forum.
So I'm lucky... he'll never see such great ideas... :D
Maybe I've missed it in the previous threads. Or maybe I'm just thick skulled ;) . But I don't recall anyone saying why they believe it is a good convention other than MS does it or other people do it. What makes it a good convention?Quote:
Originally Posted by cilu
Sure, but I could also ask why MSVS 7.x Wizards no longer prepend class names with "C".Quote:
Originally Posted by cilu
See? So much questions to be ask... :DQuote:
Originally Posted by KevinHall
Question is, how do you prefix your classes? Or you don't?
I don't prefix my classes with anything. I don't really see the need to.
Now when I'm using C for my company (yes we still have some legacy C code), then I prefix our structures with our company name's initials to avoid naming conflicts (as we use pretty common names for the applications our APIs are used in).
But cliu, I'm still waiting for you to explain to me why prepending class names with "C" is a good convention. :)
Another fact: Not only VC7 Wizard no longer prepend class names with "C", it's C# library also doesn't use "C" prefix to named it's classes. This would bring another question: If it is really good then why does MS abandon that for C# library? Probably, MS developers have figured out a reason why they don't need "C" prefix to pepper their code?
In case, somebody may ask why MFC still uses "C" prefix, it is simply because MFC has been widely used. Should MS decide to change all naming convention for MFC, it can create many tormoils. Not only all affected users have to replace all class names, they might even have to rerun tests to ensure that their programs work. This situation is very much similar to standard languages like C/C++, some decreprated functions just never die because there are always some code that use it.
Much Ado About Nothing
Back to work, philosophers!
:D
I really don't know how much you want me to elaborate on that. If you're expecting a book or something I will disappoint you. :) I kinda like the Hungarian convention, with C prefixing classes, S prefixing structures (I don't really use it, don't ask me why :D), m_ class member variables, or g_ global variables.Quote:
Originally Posted by KevinHall
Let me ask you something. You don't prefix classes. But do you prefix variables, with m_, g_ or something else? And if so, why do you do it?
I don't prefix variables with marks denoting "member" or "property" or anything like that. A member is easy to see because of the preceeding "." or "->".Quote:
Originally Posted by cilu
As for hungarian notation, it has value -- especially when pointers are used frequently, when you need to mark a boolean value in a language that doesn't have true booleans, and/or when you don't have an IDE that can help you figure out what type a variable is. The problem with hungarian notation is that with C++ there are now a lot more standard types (different from fundamental types):
vectors, lists, maps, complex (all of which so far are templates) and many others. So comming up with short abbreviations for all these types would be challenging:
vecIntName vector of integers (not too bad)
lstBoolName list of bools (not too bad either)
mapCpxIntStrName map of complex<int>s to strings (utterly confusing)
I believe that hungarian notation is better suited toward C, but for C++ insisting on it can make things more confusing than clear. I used hungarian notation for a while when using C (and some C++ a long time ago), but have have not used it for quite some time.
So in summary, no I don't prefix my variables with anything. I usually just name them clearly for their purpose (which often makes clear what the variable type is -- for example NameVector would be a vector of strings) and provide good documentation for others.
I use the C 'cause I know the wizard will make it will disapear and to use my CHARGE class I'll have to #include the HARGE.h header.
In case you don't know you have full control over the file names, both for .h and .cpp. The wizzard eliminates by default the "C" prefix from the class name and uses the rest to name the files. Just press the "Change" button and change them by your wish.Quote:
Originally Posted by RickCrone
Prepend "Charge" with a "C" ----> CCharge, then the good wizard will generate Charge.h/cpp and you'll have nomore headaches. :)Quote:
Originally Posted by RickCrone
I should have added an option on the poll: "C" because VC6's MFC class wizard adds it for me. I wonder how many people really just use "C" for that reason.
Well...I have added it... :cool:Quote:
Originally Posted by KevinHall