beautypg.com

Echelon Neuron User Manual

Page 88

background image

80

Neuron C Compiler Errors (NCC)

NCC#

Description

251

Assignment operator at top level of conditional expression [NCC#251]

This warning is issued by the Neuron C compiler when it detects a use of

the assignment operator = in the top level of a conditional expression, for
example, in an if statement.

int a, b;

.
.
.

if (a = b) // This is an assignment

Although such a code construct is legal and useful in C (it assigns the value

of 'b' to 'a' and tests that value for nonzero, simultaneously), it is also one of
the most common coding errors in C programs for novice and experienced

programmers alike. Almost all C programmers find themselves
occasionally making this error when an equality operator == is actually

intended.
The purpose of this warning is to assist programmers in finding
programming errors. The warning may be silenced by recoding the

conditional expression for an explicit test against zero. The Neuron C

compiler's optimizer will produce identical code with or without the explicit
test, due to special optimization logic for this case, thus the explicit test will

not decrease program efficiency.

if ((a = b)!= 0)

252

Use of 'snvt_si_eecode' and 'snvt_si_ramcode' are exclusive [NCC#252]

The compiler directives #pragma snvt_si_eecode and #pragma

snvt_si_ramcode are mutually exclusive, since the two directives cause the
compiler to force the placement of the SNVT/Self-Identification information

in mutually exclusive areas of memory.

253

Triac level I/O object cannot use the 'clockedge(+-)' option [NCC#253]

The triac I/O object in level mode can only use the clockedge(+) or

clockedge(-) option.

254

Triac I/O object declaration defaults to triac 'pulse' object [NCC#254]

Either pulse or level mode can be selected explicitly using the appropriate
keyword in the I/O declaration for a triac object. A declaration without an

explicit keyword will default to using pulse mode. To silence the warning,
modify the declaration to explicitly specify the triac object's mode of

operation.

255

One or more unterminated #if/#ifdef/#ifndef directives [NCC#255]

The preprocessor directives controlling conditional compilation must

always exist in matching pairs, similar to the open brace { and close brace }
in a C program. The pairs #ifdef and #endif must match, for example, with

an optional #else contained in between.