#### Archived

This topic is now archived and is closed to further replies.

# CClassname

This topic is 5657 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I know this is a religious debate for some people, but why CClassname? I''ve read many rants on the net that agree with the fact that MS chose it to use in MFC so it''d stand out, but when everyone uses it, it loses value. It seems rather redundant to me and I read so many posts that have it, so I just had to know what the rationale is behind it.

##### Share on other sites
It becomes somewhat more useful when you want to clearly distinguish between classes and interfaces.

Don''t listen to me. I''ve had too much coffee.

##### Share on other sites
I use it just to distinguish between e.g. classes and enums (class CUnit & enum EUnit [although i tend to say enum EUnitType]). I know people will say that i should name my classes better, but i still do it this way.
I also use hungarian notation to determine what type a variable is without having to find its declaration and to shorten identifier names (e.g. pszBuffer instead of ptrStringBuffer), so i guess prefixing the ''C'' is part of hungarian notation.

[HTTP 500 x3]

2p

##### Share on other sites
quote:
Original post by Sneftel
It becomes somewhat more useful when you want to clearly distinguish between classes and interfaces.

Can''t you just prefix an I to it like "iSocket" or "ISocket" (if you hate Apple ). That is a useful naming convention I think. Seems like the C is extraneous.

##### Share on other sites
People prefix class names with C so that they can remember that CBitmap is not a basic type.

##### Share on other sites
Perhaps we ought to prefix all function names with fn? Oh, wait, I can tell which identifiers are function names because of the context in which they are used:

  void fnAFunctionName () {}class CAClassName {}; int main (){  CAClassName someObject;  fnAFunctionName ();}

Gosh, it looks like I''ll have to find another way to make work.

##### Share on other sites

  void (*foo)();   foo bar = Wibble;

But i think thats just silly

##### Share on other sites
quote:
Original post by antareus
Can''t you just prefix an I to it like "iSocket" or "ISocket" (if you hate Apple ). That is a useful naming convention I think. Seems like the C is extraneous.

i is int! ;p

enum enEnumeration { one=1, two, three };
class CBanana;
int iFrogCount;
struct Apple sFruit;
typedef void tFruit;
unsigned short usFiddlers;
unsigned long ulCucumbers;
void * vpFrog;
long * lpMoose;

class Foo
{
public:
unsigned short* m_uspUshortPointer;
};

and so on.
ITS RELIGION!

What does God want?
Does God want goodness or the choice of goodness?
Is a man who chooses the bad perhaps in some way better than a man who has the good imposed upon him?

##### Share on other sites
I use cClassname.

.lick

##### Share on other sites
quote:

That is exactly my point. You can isolate any little bit of code and make an argument that Hungarian Notation will help because it attaches extra type information to most identifiers; however, the argument is flawed. Even if you attach "fn" prefix to function pointer typedefs, you still have no knowledge of what that function actually does. You should not be working on code you do not understand in the first place. It is generally more effective to improve your coding skills by learning to choose more clear and concise identifiers than it is to mutilate the code.

1. 1
2. 2
3. 3
4. 4
Rutin
17
5. 5

• 10
• 11
• 37
• 12
• 12
• ### Forum Statistics

• Total Topics
631414
• Total Posts
2999958
×