[haiku-commits] Re: haiku: hrev43559 - src/system/libroot/posix/string

  • From: "Ingo Weinhold" <ingo_weinhold@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 26 Dec 2011 23:52:57 +0100

Fredrik Holmqvist wrote:
> 2011/12/26 Ingo Weinhold <ingo_weinhold@xxxxxx>:
> > HAS_ZERO_BYTE().
> >...
> > No space after cast operator.
> 
> While the first of these is kind of obvious, neither is in the code
> style doc, so I suggest we add both. It makes it so much easier to do
> the right thing.

Sure feel free to add them.

BTW, searching the guidelines for details about casts, I noticed:

  "Use new-style casts (dynamic_cast, static_cast, const_cast, 
reinterpret_cast) over old-style."

While I certainly agree that dynamic_cast should be used when necessary, also 
like the more explicit const_cast when casting a const away, and occasionally 
find myself using static_cast to down-cast between objects of different 
classes, I would claim that the rule does not match the general practice. 
Definitely not not mine at least. I use C style casts when casting from and to 
void* and between primitive types. Can we strike or amend the rule?

> Btw, since I'm there, should I switch to a cpp file so variables can
> be declared directly?

As you like.

> Adding extern "C" around it ofc.

It's already declared such in the header.

CU, Ingo

Other related posts: