<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Release SP20 - Changes in behaviour?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a1295612f2/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a1295612f2/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/a1295612f2/</id><updated>2024-03-25T17:58:55.148000Z</updated><subtitle>Recent posts to Release SP20 - Changes in behaviour?</subtitle><entry><title>Release SP20 - Changes in behaviour?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a1295612f2/?limit=250#9bd7/dcfe" rel="alternate"/><published>2024-03-25T17:58:55.148000Z</published><updated>2024-03-25T17:58:55.148000Z</updated><author><name>Strucc.c</name><uri>https://forge.codesys.com/u/struccc/</uri></author><id>https://forge.codesys.com104b0b803b41d77a0979108b0915af5ccd24a5d6</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;This... is not very practical for me - as I have a bunch of different classes - it's just doesn't seems to be very practical to define a NULL for each of them...&lt;/p&gt;
&lt;p&gt;Something like this I use in parameter definitions. For example:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;VAR_INPUT&lt;/span&gt;
    &lt;span class="n"&gt;refVFD_Drive&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;REFERENCE&lt;/span&gt; &lt;span class="kr"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;FB_VFD_Drive&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;GVL_DUMMY&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Dummy_VFD&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_VAR&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;I use this to prepare objects for code I don't control: Typycally visualizations - had many troubles with references set on the fly, right before opening a corresponding visualization...&lt;/p&gt;
&lt;p&gt;And yes, the instance in GVL_Dummy reports itself as "Fake", so it does not influence the actual application at all. Actually this way I could invalidate a reference, just to set it to a "Dummy" instance.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Release SP20 - Changes in behaviour?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a1295612f2/?limit=250#04a0/32c8" rel="alternate"/><published>2024-03-25T17:49:36.403000Z</published><updated>2024-03-25T17:49:36.403000Z</updated><author><name>Strucc.c</name><uri>https://forge.codesys.com/u/struccc/</uri></author><id>https://forge.codesys.com9e6b2689daf5452e552346e3fa2cedccfdd4baac</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Wow.... I missed this one in the manual - so there is a special syntax to invalidate a reference... Great :) Seems to work.&lt;br/&gt;
(it's just mentionned in the examples line)... &lt;/p&gt;
&lt;p&gt;I've always assigned 0 to the variable, with := 0 - like setting a pointer to 0. In theory, that should work as well.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Release SP20 - Changes in behaviour?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a1295612f2/?limit=250#04a0/6e6e" rel="alternate"/><published>2024-03-25T17:49:29.181000Z</published><updated>2024-03-25T17:49:29.181000Z</updated><author><name>Strucc.c</name><uri>https://forge.codesys.com/u/struccc/</uri></author><id>https://forge.codesys.com8444a5f0d3e9132d8c3af6e7967d8998450eec2e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Wow.... I missed this one in the manual - so there is a special syntax to invalidate a reference... Great :) Seems to work.&lt;br/&gt;
(it's just mentionned in the examples line)... &lt;/p&gt;
&lt;p&gt;I've always assigned 0 to the variable, with := 0 - like setting a pointer to 0. In theory, that should work as well.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Release SP20 - Changes in behaviour?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a1295612f2/?limit=50#9bd7" rel="alternate"/><published>2024-03-25T02:49:28.690000Z</published><updated>2024-03-25T02:49:28.690000Z</updated><author><name>SiegeLion</name><uri>https://forge.codesys.com/u/smartcoco/</uri></author><id>https://forge.codesys.comf81c19decb8b0d14a1878c7a11825c1a577302e3</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;You should use this method:&lt;br/&gt;
VAR&lt;br/&gt;
    NULL:REFERENCE TO FB_MSG&lt;br/&gt;
END_VAR&lt;br/&gt;
Add_EVT_OUT REF= NULL;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Release SP20 - Changes in behaviour?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a1295612f2/?limit=25#04a0" rel="alternate"/><published>2024-03-24T19:06:48.159000Z</published><updated>2024-03-24T19:06:48.159000Z</updated><author><name>Fless</name><uri>https://forge.codesys.com/u/fless/</uri></author><id>https://forge.codesys.comfbfb854ff9fee18bb9c40b705fc6b4ef7ae6ac79</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;use this to set an invalid reference&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;Add_EVT_OUT REF= 0;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;</summary></entry><entry><title>Release SP20 - Changes in behaviour?</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/a1295612f2/?limit=250#cfba" rel="alternate"/><published>2024-03-24T08:55:47.943000Z</published><updated>2024-03-24T08:55:47.943000Z</updated><author><name>Strucc.c</name><uri>https://forge.codesys.com/u/struccc/</uri></author><id>https://forge.codesys.coma74d04d9e40b0081b2593c19159ffaaadf40838e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Dear all,&lt;/p&gt;
&lt;p&gt;I've just started to migrate some of my ancient projects to SP20. There is one strange error (?) I have noticed so far. In a method call, depending on the circumstances I would like to return reference to an object, or an invalid reference:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;METHOD&lt;/span&gt; &lt;span class="n"&gt;Add_EVT_OUT&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;REFERENCE&lt;/span&gt; &lt;span class="kr"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;FB_MSG&lt;/span&gt;
&lt;span class="kr"&gt;VAR&lt;/span&gt;
&lt;span class="n"&gt;END_VAR&lt;/span&gt;

&lt;span class="kr"&gt;IF&lt;/span&gt; &lt;span class="n"&gt;__ISVALIDREF&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;refMSG_Entry&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kr"&gt;THEN&lt;/span&gt;
    &lt;span class="n"&gt;Add_EVT_OUT&lt;/span&gt; &lt;span class="n"&gt;REF&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;MANAGER&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AddMsg_EVT_OUT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;refMSG_Entry&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
        &lt;span class="n"&gt;_Get_EVT_Message&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;MSG_EVENT&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kr"&gt;OUT&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; 
        &lt;span class="n"&gt;_Get_EVT_AddCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;MSG_EVENT&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kr"&gt;OUT&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kr"&gt;ELSE&lt;/span&gt;
    &lt;span class="n"&gt;Add_EVT_OUT&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_IF&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;So far setting a reference variable to 0, did this. But now, the expression Add_EVT_OUT := 0; gives an error: &lt;/p&gt;
&lt;p&gt;&lt;span&gt;[ERROR]&lt;/span&gt;         DB_WTP_370: Add_EVT_ACK &lt;a class="" href="../Line%208,%20Column%201%20(Impl)"&gt;MSG_TRIGGER_EXT&lt;/a&gt;: C0032:  Cannot convert type 'BIT' to type 'REFERENCE TO FB_MSG'&lt;/p&gt;
&lt;p&gt;Naturally... I can write:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;Add_EVT_OUT&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;DWORD#0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;But is this the correct way? Is there any constant I could use instead, like "NULL"?&lt;br/&gt;
Or this is totally wrong and to be avoided?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>