-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Static code analysis - naming conventions #86
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,7 @@ VAR_GLOBAL CONSTANT | |
// This is the max number of user-defined states (OUT, TARGET1, YAG...) | ||
// You can make this smaller if you want to use less memory in your program in exchange for limiting your max state count | ||
// You can make this larger if you want to use states-based FBs sized beyond the EPICS enum limit | ||
MAX_STATES: UINT := 15; | ||
END_VAR | ||
]]></Declaration> | ||
cnMaxStates: UINT := 15; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can see a lot of places in here where other coding styles have bled into the library: some languages recommend ALL_CAPS for constants. |
||
END_VAR]]></Declaration> | ||
</GVL> | ||
</TcPlcObject> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,8 @@ | |
<GVL Name="Global_Variables_EtherCAT" Id="{d76f2eaf-f0c3-42c2-8317-22c7ba689cf7}"> | ||
<Declaration><![CDATA[{attribute 'analysis' := '-33'} | ||
VAR_GLOBAL CONSTANT | ||
iSLAVEADDR_ARR_SIZE : UINT := 256; | ||
ESC_MAX_PORTS : UINT := 3; // Maximum number of ports (4) on ESC | ||
END_VAR | ||
]]></Declaration> | ||
cnSlaveAddrArrSize : UINT := 256; | ||
cnEscMaxPorts : UINT := 3; // Maximum number of ports (4) on ESC | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like declaring that something is a constant via the name has more value than declaring the types, that's a useful reminder for how the variable is used and that you cannot change it. I'm surprised that global variables don't have a prefix assigned, I'd assume that knowing at a glance that a variable is a global and not a local could be useful when it comes to understanding the program flow, especially if the GVL file doesn't have the After some thought, maybe the correct convention to set is to always use the |
||
END_VAR]]></Declaration> | ||
</GVL> | ||
</TcPlcObject> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we merge this, I might want to go back through and implement backwards compatibility where possible. We should be able to make a DUT_EPS alias for ST_EPS to ease the transition.