Re: What do you prepend your class names with?
The first time and last time I used the CSomeClass was because the company had a heavy influence from MS when porting to C++/NT. There was no reason for it then and no reason for it now.
But whatever floats your boat :)
/Why are we discussing this again?
Re: What do you prepend your class names with?
Quote:
Originally Posted by Mick
Why are we discussing this again?
To test a theory of mine: That people prepend their classes with "C" because they have somehow been brought up to believe that there is good reason to -- not because they actually have a good reason to. :) (OK, your company may force you to, but IMNSHO I don't believe that company has good reason.)
Re: What do you prepend your class names with?
Quote:
Originally Posted by KevinHall
To test a theory of mine: That people prepend their classes with "C" because they have somehow been brought up to believe that there is good reason to -- not because they actually have a good reason to. :) (OK, your company may force you to, but IMNSHO I don't believe that company has good reason.)
Well...most-likely the compelling reason for most of them is the fact that Microsoft does it for their MFC classes... :cool:
Re: What do you prepend your class names with?
Quote:
Originally Posted by Andreas Masur
Well...most-likely the compelling reason for most of them is the fact that Microsoft does it for their MFC classes... :cool:
That's what I believe too. It's interesting though that nobody has stated that. Perhaps people don't like being associated with MS and gravitate (perhaps subconsciously) to more "logical" reasoning for their practices.... Of course this is a pretty small sample pool.
Re: What do you prepend your class names with?
I learned C++ by jumping into MFC, and being the forgetful type, I've gotten into the habit of prepending my classes with 'C'; structs with 'S' and enumerations with 'E'. That way I know just by looking at the name if it's a struct or a class. Then, I hit the F12 key to look it up anyhow!! :)
I don't really hold an attachment to these prefixes, however old habits are hard to break...
:cool:
Viggy
Re: What do you prepend your class names with?
Actually worked for one company [about 8 years ago] that required classes to be prepended with "A" or "An". The rational... "Instance is AClassName";
Re: What do you prepend your class names with?
Quote:
Originally Posted by TheCPUWizard
required classes to be prepended with "A" or "An". The rational... "Instance is AClassName";
:eek: :lol:
Re: What do you prepend your class names with?
Quote:
Originally Posted by Andreas Masur
Well...most-likely the compelling reason for most of them is the fact that Microsoft does it for their MFC classes... :cool:
Well... for some reasons, VC7 doesn't automatically prepend the 'C' prefix anymore.
Re: What do you prepend your class names with?
Quote:
Originally Posted by TheCPUWizard
Actually worked for one company [about 8 years ago] that required classes to be prepended with "A" or "An". The rational... "Instance is AClassName";
Well...no further comments... :cool:
Re: What do you prepend your class names with?
Quote:
Originally Posted by Kheun
Well... for some reasons, VC7 doesn't automatically prepend the 'C' prefix anymore.
Well...they might have figured out that any notation dedicated to the datatype is useless for object-oriented languages... :cool:
Re: What do you prepend your class names with?
It probably also has to do with the smarter IDE. On VC7, when we position the mouse cursor over a declaratoin, it pops up tool tib indicating if it is a class, enum, etc.
Re: What do you prepend your class names with?
Quote:
Originally Posted by KevinHall
To test a theory of mine: That people prepend their classes with "C" because they have somehow been brought up to believe that there is good reason to -- not because they actually have a good reason to. :) (OK, your company may force you to, but IMNSHO I don't believe that company has good reason.)
As I already said, and also did Hokutata, I use C to prepend (this is not an english word until it gets into the Oxford Dictionary :D) my classes because it denotes class, it is used by Microsoft, because it has something to do with the Hungarian notation, because many others do it and finally because I think it is a good convention.
Deep down in my subconscious mind might be a single reason, but I'll let Freud followers to find it. :D
Another question you should ask is why did Microsoft used "C" to prefix classes in MFC from the first place?
Re: What do you prepend your class names with?
Quote:
Originally Posted by cilu
Another question you should ask is why did Microsoft used "C" to prefix classes in MFC from the first place?
Because even some MS employees are Hungarian born ;) the common language used there is English. Imagine a parallel world with MS a German company: for sure they use K as prefix for Klasse names. :D
Re: What do you prepend your class names with?
You may prepend it with "C", with other character, or do not prefix it at all.
In any case the compiler will be not upset for that. :)
It's important that your code to be easy to read by the others.
I.e. to be not necessary to add tons of comments, explain what's this, write tens-pages documents ;), hit often F12, and blah-blah...
So, if the code you are writing it's not only for your own joy, it's good to respect some naming conventions. And this it's easy, just you must want it ;)
If the convention mentioned above is already widely used, it has no sense to invent the wheel... Even you like Microsoft or not :D
Re: What do you prepend your class names with?
Quote:
Originally Posted by cilu
And by the way, the word prepend is not actually a word. It doesn't exist in any english dictionary (that I have :D ).
get Babylon :D :D