Denis Koroskin wrote:
BTW, if a macro was declared as
#define BASIC_TYPES \
TOKwchar: case TOKdchar: \
case TOKbit: case TOKbool: case TOKchar: \
case TOKint8: case TOKuns8: \
case TOKint16: case TOKuns16: \
case TOKint32: case TOKuns32: \
case TOKint64: case TOKuns64: \
case TOKfloat32: case TOKfloat64: case TOKfloat80: \
case TOKimaginary32: case TOKimaginary64: case TOKimaginary80: \
case TOKcomplex32: case TOKcomplex64: case TOKcomplex80: \
case TOKvoid
(note an absence of the first case) then it would cause compile-time
error instead of run-time bugs. Usage:
switch (token) {
case TOKidentifier:
case TOKenum:
case TOKstruct:
case TOKimport:
case BASIC_TYPES:
}
I like that. Great suggestion!