Do you usually prefix your classes with the letter 'C' or something else?

Started by
89 comments, last by Ravyne 7 years, 10 months ago

I think it's a good practice to do so.

I prefix stuff like CTextureManager, it is quite neat.

But when it comes to classes like

AStar, I feel very strange to have such a letter as the prefix...

I don't like to call it CAStar, which is very windy...

Thanks

Jack

Advertisement

I learned C++ on MSVC6, using Microsoft's conventions from the time, so I used to use CClass, IInterface, Function m_datatypeMember, etc...

Nowadays I feel that the C prefix makes the code less readable, not more readable. You can very easily tell just by context that TextureManager is a class and not a function, without any need to clutter the code with these prefixes.

Do you usually prefix your classes with the letter 'C' or something else?

1279165661008.jpg?1279168353

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.
My keyboard doesn't have a '' key. So I an't prefix my lasses. :(

It's pretty hard to ode in /++ or #.

I dont prefix my classes with anything. My convention is that classes are capitalized and that's it. Syntax coloring helps a lot in telling what's what, and along with context you dont need anything else.

I don't prefix classes. I can't say it doesn't help since I don't do it to know but I don't feel like I'm hindered from lack of doing it.

Interested in Fractals? Check out my App, Fractal Scout, free on the Google Play store.

1) Prefix class names with 'C'
2) Type 'C' in an IDE with code completion
3) Regret 1 as your code completion list fills up with a billion unrelated class names
4) ...
5) End up being found 2 weeks later, living in a cave as far from the coast as possible ranting about the ocean coming to get you...

1) Prefix class names with 'C'
2) Type 'C' in an IDE with code completion
3) Regret 1 as your code completion list fills up with a billion unrelated class names
4) ...
5) End up being found 2 weeks later, living in a cave as far from the coast as possible ranting about the ocean coming to get you...

The same applies to "m_", "g_", "lpsz" and similar wretched nonsense.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

The same applies to "m_", "g_", "lpsz" and similar wretched nonsense.

Actually, m_ for members and g_ for globals helps quite a bit while reading a lot of unknown code. For example, when doing something with threading and you see that a member is used, but can't find a mutex anywhere around.

Always sounds like a nice idea but I think most people end up regretting it. I used to prefix with S for my engine because its name began with S. Didn't take long to wish hadn't of done that.

The same applies to "m_", "g_", "lpsz" and similar wretched nonsense.

Actually, m_ for members and g_ for globals helps quite a bit while reading a lot of unknown code. For example, when doing something with threading and you see that a member is used, but can't find a mutex anywhere around.

Yeah I agree. When reading UE4 source code for example, it's hard to know what is a member variable and what isn't.

This topic is closed to new replies.

Advertisement