This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

autoreferencial structure in ROM

Dear Sir,

I use a structure like this one:

typedef struct st { char t; struct st*;}

I would like to store several structures in ROM.
I wrote the following code

const struct st1 = { 1, &st2};
const struct st2 = { 2, &st1);

The compilation produce an undefined identifier error 202 (c51 V4.02).

What can I do to solve this problem?

Best regards

Parents
  • OK, this code must work (note the extern keyword):

    struct st { char t; struct st *ptr;};
    extern const struct st st2;
    const struct st st1 = { 1, &st2};
    const struct st st2 = { 2, &st1};
    
    This looks like ANSI C compliant code to me. Same code without extern is not ANSI C compliant, I guess.
    Regards,
    - Mike

Reply
  • OK, this code must work (note the extern keyword):

    struct st { char t; struct st *ptr;};
    extern const struct st st2;
    const struct st st1 = { 1, &st2};
    const struct st st2 = { 2, &st1};
    
    This looks like ANSI C compliant code to me. Same code without extern is not ANSI C compliant, I guess.
    Regards,
    - Mike

Children
No data