[openbeosnetteam] Re: question about coding style

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: openbeosnetteam@xxxxxxxxxxxxx
  • Date: Tue, 25 Jul 2006 16:08:30 +0200 CEST

Oliver Tappe <openbeos@xxxxxxxxxxxxxxx> wrote:
> are there any coding style guidelines for haiku apart from the ones 
> from 
> OpenTracker (which are mentioned on haiku's website)?
> 
> I am asking because I am a bit confused as to what coding style is 
> actually 
> applying to haiku kernel code, as the code I read seemingly violates 
> the 
> OpenTracker guidelines here and there:
> 
> according to the guidelines...
> -     'udp_protocol' should be 'UdpProtocol'

Well, we're following the Be style too :)
C structures and methods are lower case with '_', while C++ classes are 
UpperCaseAndCombined. C structure members are lower case, too, while C+
+ members have the 'f' prefix. For global variables, the same style is 
applied, that is the 's' prefix for static variables, the 'g' prefix 
for globals, the 'k' prefix for constants.
Of course, there are many THIS_IS_A_CONSTANT cases, too, but those are 
always either defines or enums, not actual const variables (well, in 
most cases...).
This should be used consistently within the kernel, and most stuff 
outside of it, too.

> -     method declarations should be lined up (with lots of space to the 
> left)

Not sure what you mean here.

> Is there some specific coding style for the kernel?
> 
> I am very willing to follow any coding guidelines, but it *is* easier 
> if you 
> know precisely what guidelines to adhere to >;o)

Yes, the OpenTracker style guide doesn't include the C case. When you 
look at the Be headers, the C naming style seems to be consistent, but 
also different from the C++ naming style.

Bye,
   Axel.


Other related posts: