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

Pointer stored in wrong code class.

Can anyone tell me why the following code for the C167 will place the pointer in either the NDATA0 class or the XDATA0 class depending on which line is uncommented?

typedef struct
{
short type;
} DIR_ENTRY;

typedef DIR_ENTRY xhuge * DIR_PTR;


//DIR_PTR test1; // Pointer placed in the XDATA0 class.
DIR_ENTRY xhuge * test1; // Pointer placed in the NDATA0 class.

I am using version 4.06 of the compiler.

Thanks.

Parents
  • Do you know of a reference that has extensive examples of data declarations?

    The C51 Compiler User's Guide really does have a lot of examples of data declarations as well as complex pointer declarations in Chapter 3.

    One of the biggest problems new users face is the challenge of learning C on an embedded architecture.

    One of the toughest problems to explain is illustrated by the following struct definition:

    struct my_struct
      {
      int code var1;
      int data var2;
      int xdata var3;
      };
    
    struct my_struct status;

    The answer to "why won't this code work" is usually more complex than a new user can handle in one gulp.

    Jon


Reply
  • Do you know of a reference that has extensive examples of data declarations?

    The C51 Compiler User's Guide really does have a lot of examples of data declarations as well as complex pointer declarations in Chapter 3.

    One of the biggest problems new users face is the challenge of learning C on an embedded architecture.

    One of the toughest problems to explain is illustrated by the following struct definition:

    struct my_struct
      {
      int code var1;
      int data var2;
      int xdata var3;
      };
    
    struct my_struct status;

    The answer to "why won't this code work" is usually more complex than a new user can handle in one gulp.

    Jon


Children