
|
[haiku-appserver]
||
[Date Prev]
[03-2005 Date Index]
[Date Next]
||
[Thread Prev]
[03-2005 Thread Index]
[Thread Next]
[haiku-appserver] Re: private development
- From: Adi Oanca <adioanca@xxxxxxxxxxxxx>
- To: haiku-appserver@xxxxxxxxxxxxx
- Date: Fri, 25 Mar 2005 20:20:49 +0200
Hi,
Stephan Assmus wrote:
>> Yes, we know, but don't worry. After app_server reaches an almost
>>beta
>>stage we will clean the code so that things would be clearer from C++
>>'s
>>point of view.
>> However, some classes are friends and those will stay like that
>>because they need frequent
>>need of private members, and every time calling a public method which
>>returns a pointer to the object
>>in question imposes penalty on performance (method/function call
>>overhead).
>
>
> I'm not absolutely sure on this, but when I declare a method "inline"
> like so:
>
> inline const SomeType* GetSomething() const { return
> fPrivatePointer; }
>
> Wouldn't that be just as performant as using the pointer directly?
Yes, if GetSomething() is called from the same file/cls.o .
If you call it from outside that file/cls.o it is a call like all
others.
AFAIK.
> The
> method also makes it clear, that it is ment for read-only access. Of
> course, even though "SetSomething()" could also be "inline", I'd almost
> never do this. But it could be done just the same. The difference then
> is, that you can change the method later from inline to implemented in
> the cpp, should it need to take care of additional things. And most
> importantly, client code doesn't need to be changed.
Hehe, that is "the big picture". IMO, these guide lines should be
respected in general, but when you build a module there are some things
that cannot go without the other, they are small pieces of the same
object. ;-)
bye,
Adi.
|

|