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

Compiler error 143

Can anyone tell me why this piece of code builds with error 143, and how to get it to build without errors?

typedef unsigned char U8;
typedef unsigned long int U32;

#define B0(x) ((U8) ((U32)x&0xFF))
#define B1(x) ((U8)(((U32)x&0xFF00)>>8))
#define B2(x) ((U8)(((U32)x&0xFF0000)>>16))
#define B3(x) ((U8)(((U32)x&0xFF000000)>>24))

void foo(void);

BYTE abc[]={
    B0(foo),
    B1(foo),
    B2(foo),
    B3(foo)
};

void foo(void){
}

Thanks... Dave.

Parents
  • MY BAD...! I thought only C16x tool user's would've attempted to answer my question, although I do appreciate your help. FWIW, KEIL's user's manuals are online now. Not sure how long they've been online, but... the compiler reports:

    MAIN.C(35): error 143: 'scalar': initializer is not a constant
    

    The array of bytes I'm trying to create at build time contains a variety of instances of differently sized info, some of which are pointers to functions, encoded as an array of bytes. Doesn't appear to be possible to do to me, but I'm hoping it is.

    Thanks again...
    Dave.

Reply
  • MY BAD...! I thought only C16x tool user's would've attempted to answer my question, although I do appreciate your help. FWIW, KEIL's user's manuals are online now. Not sure how long they've been online, but... the compiler reports:

    MAIN.C(35): error 143: 'scalar': initializer is not a constant
    

    The array of bytes I'm trying to create at build time contains a variety of instances of differently sized info, some of which are pointers to functions, encoded as an array of bytes. Doesn't appear to be possible to do to me, but I'm hoping it is.

    Thanks again...
    Dave.

Children