/* template */
type func(type arg);
type func(type arg) {
...
}
/* example */
s32 foo(u8 byte);
s32 foo(u8 byte) {
...
}
comments/documentation
use /* ... */ for all non-temporary comments
please document all exposed functions and tid-bits inside headers with an overview of the interface (no need for describing implementation behavior as long as it's not observable to the user)
example:
/* returns a hash of the str using algorithm X */
u64 hash(std::string& str);
classes
names
lowercase
kept in appropriate namepsace
namespacedfly::audio {
classsound {
...
};
}
member names
no prefix like _ or m_, just regular names
access variables using this->... always
call member functions/methods using method(...)
/* header and source combination for example simplicity */classexample {
public:
usize index;
voidsetIndex(usize index) {
this->index = index;
}
u8 test() {
setIndex(8);
return8;
}
};