Naming conventions (2)

The Naming Conventions (2) tab contains options that extend the settings of the Naming conventions tab. You can use these options to configure how the expected overall prefix for variables/declarations is to be composed.

The observance of the naming conventions is checked during the execution of the Static Analysis.

1) First character after prefix should be an upper case letter

Examples:

Option

State

Result of the static analysis

First character after prefix should be an upper case letter

Enabled

For the definitions mentioned above, an error will be reported in each case that the first letter after the prefix must be an upper case letter. Correct identifiers would be "bVar" and "FB_Sample".

Disabled

The identifiers "bvar" and "FB_sample" are permissible. No upper/lower case error is output.

2) Recursive prefixes for combinable data types

3) Combine scope prefix with data type prefix

(namespace = scope)

Examples

FUNCTION_BLOCK FB_Sample
VAR
    var1  : POINTER TO ARRAY[1..3] OF INT;
    var2  : ARRAY[10..20] OF ARRAY[3..5] OF BOOL;
END_VAR

Option scenario 1:

Option

State

Expected overall prefix for case 1

(NC0054 = "_local_")

Expected overall prefix for case 2

(NC0054 = empty)

Recursive prefixes for combinable data types

Enabled

For var1: '_local_pan'

For var2: '_local_aab'

For var1: 'pan'

For var2: 'aab'

Combine scope prefix with data type prefix

Enabled

Explanation:

Option scenario 2:

Option

State

Expected overall prefix for case 1

(NC0054 = "_local_")

Expected overall prefix for case 2

(NC0054 = empty)

Recursive prefixes for combinable data types

Disabled

For var1: '_local_p'

For var2: '_local_a'

For var1: 'p'

For var2: 'a'

Combine scope prefix with data type prefix

Enabled

Explanation:

Option scenario 3:

Option

State

Expected overall prefix for case 1

(NC0054 = "_local_")

Expected overall prefix for case 2

(NC0054 = empty)

Recursive prefixes for combinable data types

Enabled

For var1: '_local_'

For var2: '_local_'

For var1: 'pan'

For var2: 'aab'

Combine scope prefix with data type prefix

Disabled

Explanation:

Option scenario 4:

Option

State

Expected overall prefix for case 1

(NC0054 = "_local_")

Expected overall prefix for case 2

(NC0054 = empty)

Recursive prefixes for combinable data types

Disabled

For var1: '_local_'

For var2: '_local_'

For var1: 'p'

For var2: 'a'

Combine scope prefix with data type prefix

Disabled

Explanation:

 

Further notes/examples:

For POUs with an access modifier (methods or properties), the combination of the prefix for the scope (NC0121-NC0124: PRIVATE/PROTECTED/INTERNAL/PUBLIC) and the prefix for the POU type (NC0105 for method, NC0107 for property) is expected as the overall prefix. Examples: