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

compile error of EXTERN

the error of the following code is C126: EZREGS.H(47): error C129: missing ';' before 'OUT7BUF'

Anybody knows why?

#ifdef ALLOCATE_EXTERN
#define EXTERN
#define _AT_  _at_
#else
#define EXTERN extern
#define _AT_ ; / ## /
#endif

/* Register Assignments 3/18/99 TPM */
EXTERN xdata volatile BYTE OUT7BUF[64]	_AT_	0x7B40;

Parents
  • How about:

    #ifdef ALLOCATE_EXTERN
    #define _AT_(addr)  _at_ addr
    #else
    #define _AT_(addr)
    #endif
    

    Note that you generally don't want semicolons in one-line macro definitions, since the natural way to use them probably already includes a semicolon:

    EXTERN xdata volatile BYTE OUT7BUF[64] _AT_(0x7B40);

    which winds up being syntactically correct in both cases, with no weird token-pasting comment generation required.

    Incidentally, the #if seems backwards to me. If ALLOCATE_EXTERN were defined, I'd expected to have the definitions for declaring things externally. But the definitions are the other way around.

Reply
  • How about:

    #ifdef ALLOCATE_EXTERN
    #define _AT_(addr)  _at_ addr
    #else
    #define _AT_(addr)
    #endif
    

    Note that you generally don't want semicolons in one-line macro definitions, since the natural way to use them probably already includes a semicolon:

    EXTERN xdata volatile BYTE OUT7BUF[64] _AT_(0x7B40);

    which winds up being syntactically correct in both cases, with no weird token-pasting comment generation required.

    Incidentally, the #if seems backwards to me. If ALLOCATE_EXTERN were defined, I'd expected to have the definitions for declaring things externally. But the definitions are the other way around.

Children
No data