Echelon Neuron C User Manual

Page 53

Advertising
background image

Neuron C Reference Guide

33

#pragma relaxed_casting_off
#pragma relaxed_casting_on

These pragmas control whether the compiler treats a cast that removes the

const attribute as an error or as a warning. The cast can either be explicit or

implicit (as in an automatic conversion due to assignment or function
parameter passing). Normally, the compiler considers any conversion that

removes the const attribute to be an error. Turning on the relaxed casting
feature causes the compiler to treat this condition as a warning instead.

These pragmas can be intermixed throughout a program to enable and

disable the relaxed casting mode as desired. See the example for

Explicit

Propagation of Network Variables

in Chapter 3,

How Devices Communicate

Using Network Variables,

of the

Neuron C Programmer’s Guide

.

#pragma run_unconfigured

This pragma causes the application to run whenever it is online, even if the

device is in the unconfigured state. Without this directive, the application

runs only when the device is both online and configured. You can use this
directive to have an application perform some form of local control prior to or

independently of being installed in a network.
Applications that use this pragma and run on firmware versions prior to
version 12 should not attempt to send messages when hard-offline. The hard-

offline state can be detected by calling retrieve_status( ) and checking the
status_node_state field for the value CNFG_OFFLINE. The reason for this

restriction is that the hard-offline state is used by network tools during

configuration modification. Were one to send messages in this state, the
message might be sent using invalid configuration and thus potentially go to

the wrong location. Note that an application is typically taken soft-offline

during modification so the device is only subject to these concerns if it is
power-cycled while the modification is in progress. Applications that do not

use this pragma do not ever run when hard-offline and thus are not

vulnerable to this condition.

This directive is not supported in model files.

#pragma scheduler_reset

Causes the scheduler to be reset within the nonpriority when clause
execution cycle, after each event is processed (see Chapter 7,

Additional

Features,

of the

Neuron C Programmer’s Guide

for more information on the

Neuron scheduler).
This directive is not supported in model files.

#pragma set_guidelines_version

string

The Neuron C version 2.1 (and later) compiler generates L

ON

M

ARK

information in the device’s XIF file and in the device’s SIDATA (stored in

device program memory). By default, the compiler uses “3.4” as the string
identifying the L

ON

M

ARK

guidelines version that the device conforms to. To

override this default, specify the overriding value in a string constant

following the pragma name, as shown. For example, a program could specify
#pragma set_guidelines_version “3.2” to indicate that the device conforms to

the 3.2 guidelines. This directive is useful for backward compatibility with

older versions of the Neuron C compiler.

Advertising