Store PLCnext CommunityPLCnext on LinkedInPLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

  1. Stefan Svanbäck
  2. PLCnext Technology & PLCnext Controls
  3. Wednesday, 08 September 2021
Hello,

After change of library PLCNextbase from 1.3 to 1.41 I get this warning in PLCNextEng.

WarningMessage.png

Why is there a warning on the same variable name?

Best regards Stefan
Attachments (1)
Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo
I don't know why this has suddenly appeared with the new library version, but that type of warning makes sense, and can be reproduced as follows:

- Create a new enum data type:

2021-09-08_10-16-36.jpg

- Create new program variables, one of which has the same name and type as one of the enum elements:

2021-09-08_10-18-26.jpg

- Use the variable with the ambiguous name in a code worksheet. A warning immediately appears, saying that the variable name is ambiguous.

2021-09-08_10-20-26.jpg

- Reference the ambiguous variable a second time, and a second warning appears.

2021-09-08_10-22-56.jpg

- If you really want to reference the enum element, qualify the variable name (i.e. MyEnumType#Green), or give your variable a name that isn't the same as an element of an enum type.


.
Attachments (4)
Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support
Stefan Svanbäck Accepted Answer Pending Moderation
0
Votes
Undo
Thanks for reply,
Maybe I can contact PlcNextbase team to change the enum name, test is a quite common variable name.

Br Stefan
Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo
Yes, that's a good idea. :-)
You could suggest that they prefix their enum elements with PBCL_, like they do with other parts of their library.
Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.