Conventions - Krystian-L-Lis/Stage GitHub Wiki
#Guide #Conventions
These are the conventions used in the provided examples, and the framework in general.
To align with existing Beckhoff conventions, this framework continues to use Hungarian notation for primitive types. The conventions are as follows:
Type | Prefix |
---|---|
Any integer or binary value | n |
Any real | r |
Any time | t |
Any date | d |
Any datetime | dt |
Any pointer | p |
Any interface | i |
Any | p |
Any string | s |
Exceptions:
Loop iterators (i
, j
, k
, l
) do not follow Hungarian notation.
-
Function Blocks (FBs), Structures, Unions, Enums, Functions, Programs, and Type Aliases:
Use camelCase in declarations and PascalCase in definitions. -
Interface Definitions:
Prefix interface names in declarations withi
and useI_
as a prefix in definitions.
- Use PascalCase for all method and property names.
- For private, internal, and protected POUs declared in POUs main body, prefix the name with
_
to avoid shadowing issues.
- Arrays follow the same prefix convention as their underlying type.
- All arrays must start from index 1 to maintain consistency with natural counting conventions. This approach ensures clarity across all applications, as real-world machines are never counted from zero. Mixing system-based indexing (starting at 0) with real-world logic (starting at 1) can lead to confusion and potential errors. By standardising array indexing to begin at 1, we align with intuitive human practices and avoid discrepancies across different logic implementations.
< Previous | Home | Next >