Advertising (This ad goes away for registered users. You can Login or Register)

Coding guidelines

This is the development forum of the half-byte loader project. For general Half Byte Loader questions, visit the Half Byte Loader forum.
Forum rules
This forum is for HBL Development discussions ONLY. For User support or HBL general discussions, go to viewforum.php?f=3 . Messages that are not development related will be deleted.
Post Reply
JJS
Big Beholder
Posts: 1416
Joined: Mon Sep 27, 2010 2:18 pm
Contact:

Coding guidelines

Post by JJS » Mon Sep 27, 2010 7:39 pm

Originally posted on advancedpspt.tk by wololo. Reposted by cscash241, thanks for that! I stickied this topic for convenience.

Coding guidelines for people who submit to the SVN (based on initial email by m0skit0). Coders feel free to comment.

The SVN is currently split in two: the trunk, and a branch named "p5" (partition 5). We expect the branch to contain experimental code and the trunk to be pretty stable.
  • Don't mass code. Space it, let some air pass in the code, it will prevent code from overheating xD
  • Tabs have 4 spaces, set your editors accordingly. It is also fine to set your editor so that it replaces tabs with 4 spaces.
  • Brackets go on new line, not at end of the line.
  • The more comments, the better.
  • Avoid global variables. If you really need globals, put them in the structure defined in globals.h. See this ticket for more info.
  • There's a "test" homebrew included in the trunk. Run this homebrew with HBL. If that homebrew reports errors with your code, DON'T SUBMIT your code to the SVN.

@m0skit0: I personally disagree with the following rule so for the time being I'm not including it:
All variable declarations at the start of the function, so we easily know how much stack is allocated on each function.
I think there is no reason for that, since the space on the stack is quite huge last time I checked. So we have very little risk of an overflow there. Rather, I'd prefer variables to be declared only when they are needed, to narrow their scope and avoid scope bugs. We can discuss this if you want.
Advertising

Post Reply

Return to “Half Byte Loader Development”