[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coding Standards



Peter Burns wrote:

>Are there any coding standards for this project?
>
>By this I mean standards for naming variables, classes, etc,
>coding style, the way code should be indented, where to stick braces
>etc.

Well, yes, there exists a minimalistic draft of such standards, but it's
not on the website yet (good that you remind me of it). I attached it below.

Cu
	Christian

--

AAAAA - American Association Against Acronym Abuse
Title: PenguinPlay Coding Standard Draft
OK this is a draft of a minimal coding standard designed for PPlay. This is only a draft, or more accurately, a discussion doco, mostly I am stating my own opinion so you should probably tell me why I am wrong (or just tell me to shut up and tow the line). This doco does not even neccesarily reflect the currently used coding practices. I have also left some issues open.

Symbol Naming

Prefixes

I'm not sure if we ever got around to figuring out prefixes to use for what. So I will just list the ones already in use, and if you need to invent a new one, go ahead. pp - General stuff. ppg - Graphics. So the only real rule is to not cause a collison and start with pp. Also if you have one of those must-be-public-even-though-we-want-to-hide-it things, then prepend a _, if is a macro then "prefix" becomes "PREFIX_" (or _prefix becomes _PREFIX_). You know, common sense.

CaPItaLizatION

If I have my way then _everything_ which is public, whether of global scope or not, should be in CapsForTheStartOfEachWordIncludingTheFirst. What is private is private (although I prefer simples_with_underscores). For some reason, C++ programmers around the world seem to do the same, except class members are capForStartOfAllButTheFirstWord. I think this is insane because