×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    1

    Question Wy so many inline contruction function?

    Under S60 3rd environment,when I debug my app, I find that many construct functions are declared as inline!

    I can't understand wy?

    Can some experts give me some instructions?


    THks
    e.g: In e32cmn.h,following is the delcaration of TBuf:

    template <TInt S>
    #if defined(_UNICODE) && !defined(__KERNEL_MODE__)
    class TBuf : public TBufBase16
    #else
    class TBuf : public TBufBase8
    #endif
    {
    public:
    inline TBuf();
    inline explicit TBuf(TInt aLength);
    inline TBuf(const TText* aString);
    inline TBuf(const TDesC& aDes);
    inline TBuf<S>& operator=(const TText* aString);
    inline TBuf<S>& operator=(const TDesC& aDes);
    inline TBuf<S>& operator=(const TBuf<S>& aBuf);
    private:
    TText iBuf[__Align(S)];
    };

  2. #2
    Nokia Developer Champion
    Join Date
    Jul 2004
    Posts
    2,015

    Re: Wy so many inline contruction function?

    If you read a C++ book, or google for C++ and benefits of inline, what does it say?

  3. #3
    Registered User
    Join Date
    Aug 2009
    Posts
    1

    Smile Re: Wy so many inline contruction function?

    1ne code copy run different environment.
    e.g:
    #if defined(_UNICODE) && !defined(__KERNEL_MODE__)
    class TBuf : public TBufBase16
    #else
    class TBuf : public TBufBase8
    #endif

    2:easy way for debug or something
    e.g:
    #if define(_DEBUG_STATE)
    //DO DEBUG CODE
    #else
    //DO RELEASE CODE
    #endif

  4. #4
    Regular Contributor
    Join Date
    Oct 2007
    Location
    China
    Posts
    269

    Re: Wy so many inline contruction function?

    Quote Originally Posted by HugoQiao View Post
    1ne code copy run different environment.
    e.g:
    #if defined(_UNICODE) && !defined(__KERNEL_MODE__)
    class TBuf : public TBufBase16
    #else
    class TBuf : public TBufBase8
    #endif

    2:easy way for debug or something
    e.g:
    #if define(_DEBUG_STATE)
    //DO DEBUG CODE
    #else
    //DO RELEASE CODE
    #endif
    what Kongtao ask is the inline function but the macro.
    the main purpose of using inline function it reduce the overhead of function invoke.
    I am a programmer,and I hope we can help each other and progress together

  5. #5
    Regular Contributor
    Join Date
    Apr 2008
    Location
    India
    Posts
    477

    Re: Wy so many inline contruction function?

    template <TInt S>
    #if defined(_UNICODE) && !defined(__KERNEL_MODE__)
    class TBuf : public TBufBase16
    #else
    class TBuf : public TBufBase8
    #endif
    {
    public:
    inline TBuf();
    inline explicit TBuf(TInt aLength);
    inline TBuf(const TText* aString);
    inline TBuf(const TDesC& aDes);
    inline TBuf<S>& operator=(const TText* aString);
    inline TBuf<S>& operator=(const TDesC& aDes);
    inline TBuf<S>& operator=(const TBuf<S>& aBuf);
    private:
    TText iBuf[__Align(S)];
    };
    if we take the case of descriptor which are used too much in any symbian application that if it will be normal function then the overhead will be too much and if it will be inline then the performance will be good of the symbian apps.

Similar Threads

  1. Why don't S60 emulator loading?
    By K.John in forum Feedback - Nokia Developer Services & Infrastructure
    Replies: 9
    Last Post: 2009-08-11, 11:03
  2. ShortMsgReceived - Delphi
    By qb_soft in forum PC Suite API and PC Connectivity SDK
    Replies: 9
    Last Post: 2008-06-22, 10:30
  3. Help with lnk2019 lnk1120 error
    By yuenfatt in forum Symbian
    Replies: 8
    Last Post: 2007-08-24, 08:21
  4. EXecute function in RDbStoreDatabase
    By symbians60 in forum Symbian
    Replies: 4
    Last Post: 2007-01-23, 10:59
  5. C-code..unable to make sis
    By Symbian_Neil in forum Symbian
    Replies: 9
    Last Post: 2006-12-02, 07:55

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •