<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Compiler 3.5.18 what's happening?????????</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/09b02401ac/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/09b02401ac/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/09b02401ac/</id><updated>2022-05-06T06:36:12.335000Z</updated><subtitle>Recent posts to Compiler 3.5.18 what's happening?????????</subtitle><entry><title>Compiler 3.5.18 what's happening?????????</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/09b02401ac/?limit=250#7c18" rel="alternate"/><published>2022-05-06T06:36:12.335000Z</published><updated>2022-05-06T06:36:12.335000Z</updated><author><name>dFx</name><uri>https://forge.codesys.com/u/dfx/</uri></author><id>https://forge.codesys.com2882b808f9b6c9a1bb7f2837a8d60b192387fabd</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I'm no part of codesys.&lt;/p&gt;
&lt;p&gt;C0139 Warning pops up because your pointer value is read only at intitialisation. But the address may change with an online change : (see first hint)&lt;br/&gt;
&lt;a href="https://help.codesys.com/webapp/_cds_cmd_online_change;product=codesys;version=3.5.14.0" rel="nofollow"&gt;https://help.codesys.com/webapp/_cds_cmd_online_change;product=codesys;version=3.5.14.0&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Enumerations are a list a values that a variable may take. Meaning that this variable is expected to not take any other value than those defined in the enumeration. &lt;br/&gt;
Using such a type on an input is weird, because you should handle the other case (unexpected values) with a default value. So it does not feel weird to me to get a warning on this point.&lt;/p&gt;
&lt;p&gt;OOP does not forbid accessing properties. This is the exact opposite. It advise using properties to protect your internal values. &lt;a href="https://help.codesys.com/webapp/_cds_obj_property;product=codesys;version=3.5.14.0#get-and-set-accessors" rel="nofollow"&gt;https://help.codesys.com/webapp/_cds_obj_property;product=codesys;version=3.5.14.0#get-and-set-accessors&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Compiler 3.5.18 what's happening?????????</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/09b02401ac/?limit=25#a239" rel="alternate"/><published>2022-05-05T16:41:45.468000Z</published><updated>2022-05-05T16:41:45.468000Z</updated><author><name>mondinmr</name><uri>https://forge.codesys.com/u/mondinmr/</uri></author><id>https://forge.codesys.com267f8643ace946e18f009cb6e0787bd67c3a3ef3</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Also pragma {warning 'some text'} is no more working in my setup.&lt;br/&gt;
So is no more possible show important TODO information at compile time!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Compiler 3.5.18 what's happening?????????</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/09b02401ac/?limit=25#a763" rel="alternate"/><published>2022-05-05T09:53:52.127000Z</published><updated>2022-05-05T09:53:52.127000Z</updated><author><name>mondinmr</name><uri>https://forge.codesys.com/u/mondinmr/</uri></author><id>https://forge.codesys.com3c892badc2bd2965693ae9abdb0a0d4152cb30cb</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;In 3.5.18 there are too many false warnings and errors!!!&lt;/p&gt;
&lt;p&gt;Warning like in attachment can be ignored, but is a non sense!!!!!!!!!!&lt;/p&gt;
&lt;p&gt;For example to avoid unreadable UNIONS that make only confusion we use a bits structure:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;TYPE SimpleAxisControlWord :&lt;/span&gt;
&lt;span class="err"&gt;STRUCT&lt;/span&gt;
&lt;span class="err"&gt;    switchOn : BIT;&lt;/span&gt;
&lt;span class="err"&gt;    enableVoltage : BIT;&lt;/span&gt;
&lt;span class="err"&gt;    quickStop : BIT;&lt;/span&gt;
&lt;span class="err"&gt;    enableOperation : BIT;&lt;/span&gt;
&lt;span class="err"&gt;    startMove : BIT;&lt;/span&gt;
&lt;span class="err"&gt;    free5 : BIT;&lt;/span&gt;
&lt;span class="err"&gt;    free6 : BIT;&lt;/span&gt;
&lt;span class="err"&gt;    faultReset : BIT;&lt;/span&gt;
&lt;span class="err"&gt;    halt : BIT;&lt;/span&gt;
&lt;span class="err"&gt;    free9 : BIT;&lt;/span&gt;
&lt;span class="err"&gt;    free10 : BIT;&lt;/span&gt;
&lt;span class="err"&gt;    free11 : BIT;&lt;/span&gt;
&lt;span class="err"&gt;    free12 : BIT;&lt;/span&gt;
&lt;span class="err"&gt;    free13 : BIT;&lt;/span&gt;
&lt;span class="err"&gt;    free14 : BIT;&lt;/span&gt;
&lt;span class="err"&gt;    free15 : BIT;&lt;/span&gt;
&lt;span class="err"&gt;END_STRUCT&lt;/span&gt;
&lt;span class="err"&gt;END_TYPE&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;We map structure to raw controlword in variable declaration:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;VAR&lt;/span&gt;
&lt;span class="err"&gt;    m_controlWordRaw : UINT;&lt;/span&gt;
&lt;span class="err"&gt;    m_controlWordPtr : POINTER TO SimpleAxisControlWord := ADR(m_controlWordRaw);&lt;/span&gt;
&lt;span class="err"&gt;    m_controlWord : REFERENCE TO SimpleAxisControlWord REF= m_controlWordPtr^;&lt;/span&gt;
&lt;span class="err"&gt;    m_statusWordRaw : UINT;&lt;/span&gt;
&lt;span class="err"&gt;    m_statusWordPtr : POINTER TO SimpleAxisStatusWord := ADR(m_statusWordRaw);&lt;/span&gt;
&lt;span class="err"&gt;    m_statusWord : REFERENCE TO SimpleAxisStatusWord REF= m_statusWordPtr^;&lt;/span&gt;
&lt;span class="err"&gt;...&lt;/span&gt;
&lt;span class="err"&gt;END_VAR&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;It's like a fake union many times more readable in code!&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;IF m_statusWord.fault THEN&lt;/span&gt;
&lt;span class="err"&gt;   ....&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;From 3.5.18 a tedious C0139 Warning is compared! This warning tell that m_controlWordRaw isn't used in code! This is only apparent due use of a reference in declaration!&lt;/p&gt;
&lt;p&gt;Second problem is impossibility to map ENUMS in IO_Mapping!!!&lt;br/&gt;
This now bring in a ERROR!&lt;/p&gt;
&lt;p&gt;It's a non sense due variables like modeOfOperation should be managed with ENUMS!&lt;br/&gt;
Use of magic numbers in an application is a criminal development method! This error is an invite to magic numbers usage!&lt;/p&gt;
&lt;p&gt;Example if we define:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;{attribute 'strict'}&lt;/span&gt;
&lt;span class="err"&gt;TYPE SimpleAxisModeOfOperands :&lt;/span&gt;
&lt;span class="err"&gt;(&lt;/span&gt;
&lt;span class="err"&gt;    ProfilePosition := 1,&lt;/span&gt;
&lt;span class="err"&gt;    HomingMode := 6,&lt;/span&gt;
&lt;span class="err"&gt;    CyclicPositionMode := 8&lt;/span&gt;
&lt;span class="err"&gt;) USINT;&lt;/span&gt;
&lt;span class="err"&gt;END_TYPE&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;When we map a SimpleAxisModeOfOperands variable to IO field we raise error!&lt;/p&gt;
&lt;p&gt;Third problem is ERROR returning REFERENCE TO in methods!&lt;br/&gt;
It's in opposite side of OOP paradigm! In opposite side should be implemented also CONSTANT REFERENCE TO!&lt;/p&gt;
&lt;p&gt;If is not possible usage of REFERENCE TO in return value we are invited in a OOP privacy violation! A non sense in a OOP paradigm where all properties of an object should remain private and exposed only via methods!&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>