On 09/02/2014 08:33 PM, Pepijn Noltes wrote:
[...]
For example, the Apache httpd code styleguide
https://httpd.apache.org/dev/styleguide.html could be used by us as well?
What do you think?
I do follow the Eclipse K&R style with one change, instead of tabs I use
spaces. I do know most C/C++ developers prefer the opening brace on a new
line, I even think officially K&R has this. But the Eclipse version does
place it on the same line, which is what I prefer.
THe K&R style, as far as I know, only addresses formatting and
indentation. I think clear documentation how we use an (sort of)
object oriented programming style (mapping OSGi classes), what the
guidelines are for services (e.g. using an opaque pointer as first
entry), the general use of opaque pointer, how/when we use typedefs
and how we handle errors and return values can be very helpful.
Although some parts are described in the documentation/design
documentation/mapping pages, I can understand that not everything is
directly clear for new developers.
I would be helpful I somebody could point out what aspect of "code
style" is least clear from just looking at the code, than we could
focus on documenting that. Because in my opinion the K&R style should
be clear just with the current code.
Well then it seems that we - at least for the code style - agreed on
K&R including the following deviations:
- the use of spaces instead of tabs (and tab width of 4, I assume)
- the opening brace on the same line (as eclipse does it)
- a maximum line width of 120 characters?
Regards,
Bjoern