Variable naming prefix question

40% in and loving the course! However, the Cinemachine convention of prefixing private member variables has me wondering: What’s the standard? The instructors here at GameDev.tv seem unanimous in dropping any prefix, but often with other courses and such I’ll see the “m_” or (my favourite) just “_” as a prefix.

Is this an indie vs. larger industry divide? Are there any hard preferences out there? Love to get some insight on this.

1 Like

Here is a cheatsheet for the naming conventions I use (and are used to)

Also, the link to Microsoft’s docs on their coding conventions

The cheatsheet and ms conventions appear to be very similar (I see static and thread_static naming in ms docs that differ)

I also prefer my constants to be all caps, with _ word separation (LIKE_THIS). Just a personal thing

2 Likes

I’ve only worked solo so can’t really comment on what is the wider used format. But I’ve seen just about anything, some with m_ others just _ others no prefix.
Personally I prefer no prefix, I think I remember seeing the code for Celeste and it had prefixes or maybe it was some other indie game, and Unity as a massive company does seem to use the prefix. So maybe it is a indie vs large dev thing but not sure.
The more important thing is that you are consistent with whatever style you define. Either solo or as a team, define a standard and stick with it.

2 Likes

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms