Skip to main content
Visitor II
September 21, 2006
Question

COSMIC question

  • September 21, 2006
  • 3 replies
  • 1328 views
Posted on September 21, 2006 at 12:09

COSMIC question

    This topic has been closed for replies.

    3 replies

    pete3Author
    Visitor II
    September 21, 2006
    Posted on September 21, 2006 at 08:54

    Hello COSMIC gurus. What is wrong with the following code?

    union

    {

    unsigned int i;

    unsigned int * p;

    struct

    {

    unsigned char h;

    unsigned char l;

    } b;

    } pt;

    The error is in the pointer declaration. I have tried modifying this with the @near directive (since I want a 2-byte pointer) but no luck. The compiler tells me a member is missing. Removing the pointer declaration makes the compiler happy. I'm quite confused because I've used unions before with this compiler without problems.

    I am using V4.5.5 (eval) and the target is a 72F521R9.

    pete3Author
    Visitor II
    September 21, 2006
    Posted on September 21, 2006 at 09:18

    Forget that. Just had to use a variable name bigger than one character.

    pete3Author
    Visitor II
    September 21, 2006
    Posted on September 21, 2006 at 12:09

    ... as the program includes this line:

    #define p 5

    !