[haiku-commits] Re: haiku: hrev46896 - src/preferences/keymap

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 21 Feb 2014 10:46:52 +0100

Am 21/02/2014 00:12, schrieb John Scipione:
On Thu, Feb 20, 2014 at 5:41 PM, Jérôme Duval <korli@xxxxxxxxxxxxxxxx> wrote:
2014-02-20 21:21 GMT+01:00  <jscipione@xxxxxxxxx>:
   Convert private class member methods to static functions.
Why do you convert these?
http://www.akiwi.co.uk/article_001.html

I can see most of them being useful independently from the class, but pulling _SwapModifiersMenuItem() out of the class context makes no sense to me.

About that article: don't just believe everything that is written.

There is only one good reason for moving member functions out of the class context: reusability in other contexts. If stuff belongs to a class, it should be there, and not live as a static function.

There is another one to make member functions static, though: you save one argument on the stack (the object) which makes for a slightly faster call.

Bye,
   Axel.


Other related posts: