I use Code Composer Studio v4.2.4.00033 for C2000
processors.
I just enabled the -pdr ("Issue remarks") option on my C2000
compiler and now when it encounters a line in one of my
standard headers:
#if (defined(MCU) && (MCU == 2812))
C2000 issues the following diagnostic:
"line 65: remark #195-D: zero used for undefined
preprocessing identifier"
I have been writing C expressions of this form for 24 years,
using a broad spectrum of compilers (and I teach C++ at a
junior college) under the principle of "short circuit
expression evaluation," i.e. if the subexpression
"defined(MCU)" is false, the whole expression is false, and
subexpression "(MCU == 2812)" is never evaluated.
My belief is backed up by section 2.6 of K&R2.0 (pp. 41-42)
and the ANSI C standard, at least through C99 (sections
6.5.13 bullet 4 and 6.5.14, bullet 4)
In my dialect of C, there is no undefined identifier in this
expression. Am I missing something?