Re: Initialization Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Thorsten Schilling

    Re: Initialization Problem

    Thanks a lot for the answer so far. I know that it is pointless to
    have a one-element array, it should become an array (or pointer to the
    first of n) of syms afterwards. My specific question is if I can now
    somehow "compact" this 4 lines:
    static unsigned int vector = {1, 2};
    static unsigned int array = {{1, 2}, {1,2}, {1,2}};
    static unsigned int *rows[] = {array, array+1, array+2};
    static sym testdata = { vector, rows, 3);
    in one "line". I will have a lot syms (approx 128) where each will
    have approximately 2^7 rows with width 2, which will cause a lot
    unnecessary generation of static variables i'll never use. So for
    example "static unsigned int vector = {1,2}; causes "vector" to store
    the address of the first element. But with which language construct/
    feature can i get out of the expression "{1,2}" the address of the
    first element without the detour of a variable named vector? Cause I
    don't really need it. It is enough if it is stored in the first
    element of my sym datatype.

    Thanks again,
    Thorsten


Working...