Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Coding style guidelines?
#1
Do we have a written set of coding style guidelines anywhere for PPSSPP? I'm noticing a lot of inconsistencies in how the code is laid out, in files such as sceNet.cpp and sceIo.cpp. I'm guilty of it too, since I'm unsure of how the code should be styled.

For example:
u32 sceNetAdhocInit() {
//... body omitted
}

versus

u32 sceWlanGetEtherAddr(u32 addrAddr)
{
//...body omitted
}

Should braces be on a new line(that's how I prefer it, but I can change for contributing.. <_<) or on the same line as a function declaration/if statement?

Also, how about comments?

Is this prefered:
//Line 1
//Line 2
//Line 3

Or this?
/*Line 1
*Line 2
*Line 3*/
Reply
#2
it´s stated here:
http://ppsspp.org/development.html

like dolphin coding style:
https://code.google.com/p/dolphin-emu/wiki/CodingStyle
Reply
#3
This page says Dolphin's style:
http://www.ppsspp.org/development.html

I personally like that style, although I also hate "{}" prefering "continue;" or similar and a few other rules. That said, I'm pretty sure other code has moved towards using braces on the same line (but generally the same style otherwise.) Also, some other differences such as member variables using underscore suffix instead of m_, etc.

Definitely // is preferred. Personally I like to reserve /* */ for blocking out large sections of code, and it doesn't work if that code has /* c-style comments */ in it.

I think the most important thing personally is to follow the prevailing style in the surrounding code. Since the coding guidelines still say my preferred bracing style, for new files I go with that, heh.

-[Unknown]
Reply
#4
Thanks, I missed those links.
Reply


Forum Jump: