×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    46

    Is global variable really bad in S60 3rd or above

    In my project, I really need to use some very large global arrays, such as:

    uint64 data1[5000];
    uint16 data2[10][20][10];

    I have heared that it's not recommended to use global variable under Symbian,
    but I don't know the exact side-effect. Could someone point it out? Thanks a lot.

  2. #2
    Registered User
    Join Date
    Feb 2007
    Location
    India
    Posts
    1,128

    Re: Is global variable really bad in S60 3rd or above

    In this case, It's occupied huge memory throughout programs....It's better you can use Dynamic Array instead of static array....create a class and store data in member variables and append pointer in dynamic array instead of whole data......

  3. #3
    Registered User
    Join Date
    Sep 2010
    Posts
    46

    Re: Is global variable really bad in S60 3rd or above

    actually, The data in my application is used throughout the program.
    When the program is runing, it will access the data frequently.

  4. #4
    Registered User
    Join Date
    Feb 2007
    Location
    India
    Posts
    1,128

    Re: Is global variable really bad in S60 3rd or above

    You can optimize your data as per your requirement ...by dynamic array...if you are using static array then its store on stack....

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,734

    Re: Is global variable really bad in S60 3rd or above

    In .exe code global variables with runtime initialization are rather harmless.

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

    Re: Is global variable really bad in S60 3rd or above

    Quote Originally Posted by kis_spn View Post
    You can optimize your data as per your requirement ...by dynamic array...if you are using static array then its store on stack....
    Global data isn't stored on the stack. Its not stored on the heap neither.

Similar Threads

  1. How to use Global Variable in Symbian C++
    By Jaya_Prakash in forum Symbian
    Replies: 4
    Last Post: 2010-06-11, 13:30
  2. Use global variable in s3rd
    By andrew_lin in forum Symbian
    Replies: 6
    Last Post: 2008-05-03, 11:53
  3. Bad destination file(s) on S60 3rd edition
    By ag24master in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2006-09-12, 09:47
  4. Global variables and S60 3rd edition
    By joussen in forum Symbian
    Replies: 4
    Last Post: 2006-03-10, 16:48
  5. How to declare a global variable?
    By supertoync in forum Symbian
    Replies: 0
    Last Post: 2005-11-12, 21:34

Posting Permissions

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