SourceForge has been redesigned. Learn more.
Close

strange behavior with "static" keyword

arulnambi
2013-05-31
2013-06-06
  • arulnambi

    arulnambi - 2013-05-31

    Hello all,
    I found a strange behavior when using static keyword.
    I defined a global array with
    static __xdata uint_8 test_array={1,2,3,4}; & a structure

    typedef struct{uint_8 array1[6]; uint_8 array2[6]}test_structure;

    __xdata test_structure structure1[5]; /// list of structure

    I found that both array "test_array" & "structure1" starts in the same address.
    Did someone had the same behavior before ???

     
  • Maarten Brock

    Maarten Brock - 2013-06-06

    uint_8 is not a standard type, I suggest uint8_t from stdint.h.
    Further the "array" has no [ ] so it can't really be an array.

    The array and the struct should not end up in the same place. If it does create a small test to reproduce the behaviour and file a bug report with it.

     

Log in to post a comment.