beautypg.com

Echelon Neuron User Manual

Page 87

background image

Neuron Tools Errors Guide

79

NCC#

Description

248

Comparison is ineffective - result of comparison is a constant [NCC#248]

A conditional expression (comparison) which involves a constant value that

is out of the range of a variable value is an ineffective comparison; one that
always resolves to either the constant TRUE or the constant FALSE. The

Neuron C compiler detects such a condition and issues a warning assuming

that the comparison might be erroneous. This situation most commonly
occurs when an unsigned short is compared with a negative number, or a

short is compared with a constant that is a long. Recall that Neuron C
defines short to be 8 bits and long to be 16 bits.

void f(void) {
int i;
if (i < 300) {
// The comparison shown above is an
// ineffective comparison, since 'i'
// can only be in the range -128..127.
// The constant 300 is a long. This
// is most likely a programming error.
}
}

249
250

Loop, branch, or ‘when’ condition is always TRUE [NCC#249]

Loop, branch, or ‘when’ condition is always FALSE [NCC#250

The Neuron C compiler detects when some conditions are always FALSE or

always TRUE. This warning is generated to help programmers ensure that
their program is correct. A condition that is always FALSE, or TRUE, may

result from an erroneous conditional expression.