-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decide on basic code style guidelines #38
Comments
Since we're doxycommenting each function, I doubt there is need to use IN/OUT/INOUT attributes anymore. Removing them and allowing putting more than one arg in function declaration would decrease header size - currently blit.h is ugly as hell. |
I've updated brace omission to not allowed, since diff reasons are indisputable |
I'd really drop IN/OUT attributes since they are not that standard, intellisense skips them and vscode doxycomments plugin which I use wrongly suggests them as var type and proper type as var name. |
Is there any alternative way to annotate function argument as |
Not really. Most common practice for input ptrs is to declare them as const ptr. |
I've added include guards replacement candidate. @approxit let me know what you think. |
+1 on guards from me and +1 on ditching |
Since this is multi-ppl project, a decision has to be made how code should be formatted on repo. Feel free to post suggestions below - I'll edit first post as discussion progresses.
Brace omitting - not allowed
Pros:
Cons:
Tabs vs spaces
Code folding
Code is horizontally limited to 80 chars, so naturally some code folding must be done.
For functions in C files:
Whereas in header files:
Other arg formatting stuff doesn't mix with variable tab size properly. So I guess it must stay this way.
Naming conventions
camelCase with prefixes. List of prefixes:
ub
- unsigned byte (UBYTE
,uint8_t
)uw
- unsigned word (UWORD
,uint16_t
)ul
- unsigned long (ULONG
,uint32_t
)-
b
,w
,l
for signed variantsp
- any pointer or arraycb
- any function pointer (callback)t
- typedefs
- struct instanceu
- union instancef
-float
or fixed-point vardouble
,uint64_t
for global var scoping additionally:
g_
- global visible from other filess_
- global visible from current file (static
)Misc stuff
in header files, args should be documented usingIN
,OUT
andINOUT
defines:all fns in header files must be documented using DoxyComments. Functions which are not exported in headers should be documented in .c file
functions should be as short as possible. If needed, split function to multiple ones. There is no hard limit for fn length, but if it doesn't fit entirely on your screen then it's a good sign you're doing something wrong.
Include guards
Currently we use something like that:
Candidate for replacement:
Pros:
inc/ace/managers/blit.h
The text was updated successfully, but these errors were encountered: