The following code generates a this error when compiled: C51 COMPILER V6.02 - SN: XXXXX-XXXXX COPYRIGHT KEIL ELEKTRONIK GmbH 1987 - 1999 *** ERROR C221 IN LINE 7 OF QUEUE_I.H: non-constant case/dim expression
const unsigned char code BUF_SIZE = 40; BYTE Qbuf[BUF_SIZE];
#define BUF_SIZE 40
In addition, I've read Good Style practices that recommended using const rather than #define Then get back to whoever wrote them and challenge them about this aspect --- they must either be talking about programming languages similar in syntax to C, but different (Java or C++, e.g.), or they simply don't know what the heck they're talking about, and should refrain from handing out advice to others. The loop-hole that let GCC compile this code is that it (and the C99 standard now, too) allow variable-size arrays. But for most practical purposes, good C programming style these days is still based on C89+addenda, not C99.