Echelon Neuron User Manual

Page 60

Advertising
background image

52

Neuron C Compiler Errors (NCC)

NCC#

Description

55

Storage class on struct/union field not permitted [NCC#55]

A field in a struct or union may not have a storage class, and may not

contain the word typedef. Nor can it be a message tag, a timer object, nor a
network variable, nor can it have bind_info. Note also that a union may

not contain bitfields.

56

Enum constant out of range [NCC#56]

In Neuron C as in ANSI C, an enumerated type, declared using the enum
keyword, is equivalent to an int type. The int type is signed. In Neuron C,

an int is implemented using 8-bit signed two’s complement representation.

Thus, the valid range of enumerated type values is –128 to +127.

57

Enum value wrapped around to negative [NCC#57]

The enumerated type automatically assigns consecutive integers as the
values of the named constants unless specifically given a value for a

constant. When

literal-constant-n

has the value 127, and

literal-constant-

n+1

appears, the compiler automatically assigns it the “next” value. In

Neuron C, this value is -128 (since the enum type is signed in ANSI C).

The compiler issues a warning diagnostic for this condition, and proceeds.

58

Nothing was declared [NCC#58]

Similar to

Declaration defaults to ‘int’,

No declaration for formal

parameter - int assumed

, in a situation like the following:

long; int j;
This is legal C, but may not be what the programmer intended. Thus, for
the “first” declaration (the statement long;) this diagnostic is produced.

Many C compilers do not issue a warning in these circumstances. Note

that Neuron C will

not

issue a warning in the following cases, since

something

is

being declared (namely the enum's or the struct field names,

respectively):
enum { FALSE, TRUE } ;

struct { int a; int b; };

59

Expression type mismatch [NCC#59]

These error diagnostics result from combining expressions of conflicting

types, such as assigning an int to a pointer, or a pointer of one type to a

pointer to another type, or in using objects that have no value (such as
message tags or I/O object names) in expressions.
In many cases in ANSI C, you must use an explicit type cast. However,
note that casting should be avoided if possible, as it is often masking poor

programming practice.

60

Invalid subscript operation [NCC#60]

The compiler outputs this diagnostic when an array-index operator

[

expr

] is applied to a variable that is not a pointer or an array.

Advertising