<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Preventing write access to variable declared as VAR_IN_OUT</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/a2840ac774/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/a2840ac774/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/a2840ac774/</id><updated>2020-02-27T22:44:27.706000Z</updated><subtitle>Recent posts to Preventing write access to variable declared as VAR_IN_OUT</subtitle><entry><title>Preventing write access to variable declared as VAR_IN_OUT</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/a2840ac774/?limit=25#5eb7" rel="alternate"/><published>2020-02-27T22:44:27.706000Z</published><updated>2020-02-27T22:44:27.706000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.com6b21a3008f59f6e87f5d795c5b8db3b899b476fc</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;so why not use a input structure and a separate output structure, this is far better as everything in a big structure.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Preventing write access to variable declared as VAR_IN_OUT</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/a2840ac774/?limit=25#9974" rel="alternate"/><published>2020-02-27T22:44:23.192000Z</published><updated>2020-02-27T22:44:23.192000Z</updated><author><name>jking22</name><uri>https://forge.codesys.com/u/jking22/</uri></author><id>https://forge.codesys.com686303ae866bb09db081f48b79e67a5524242aad</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thanks for the feedback...  To clarify my intent...&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;I want to declare it as a var_in_out because:&lt;br/&gt;
         a.  var_in_out is passing structure by reference, so I'm not copying a large structure every cyclic.&lt;br/&gt;
         b.  var_in_out is the only way I know of in CodeSys 2.3 to enforce that my input actually get's assigned when the POU is called.  It's very easy in a large project to add a new variable to a function block and then forget to assign that input in every instance.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;I'd like to make the variable const (at least in the C++ sense) because I want to protect the large structure from being written to inside that POU.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;i.e. I'm trying to put a little syntactic salt into our code base.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Preventing write access to variable declared as VAR_IN_OUT</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/a2840ac774/?limit=25#0abd" rel="alternate"/><published>2020-02-27T22:44:21.595000Z</published><updated>2020-02-27T22:44:21.595000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.combbf9012f0fe6c8de4ecad7b632e6b5825f63854c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;You should get an error as a constant is unwritable, however you declare it as in_out. Question is why is it used as an input.&lt;br/&gt;
probably the thinking is a little weird.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Preventing write access to variable declared as VAR_IN_OUT</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/a2840ac774/?limit=25#45d6" rel="alternate"/><published>2020-02-27T22:44:17.177000Z</published><updated>2020-02-27T22:44:17.177000Z</updated><author><name>t.lundahl</name><uri>https://forge.codesys.com/u/t-lundahl/</uri></author><id>https://forge.codesys.com4071f3051eeb6a74223a3b455fbd5a36c3f61ee5</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi John,&lt;/p&gt;
&lt;p&gt;You can declare VAR_INPUT CONSTANT, but I don't think this will work on a IN_OUT.&lt;/p&gt;
&lt;p&gt;We use this to 'name' funktionblocks, otherwise there will be a compiler warning.&lt;/p&gt;
&lt;p&gt;/Torbjörn&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Preventing write access to variable declared as VAR_IN_OUT</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/a2840ac774/?limit=25#f379" rel="alternate"/><published>2020-02-27T22:44:15.600000Z</published><updated>2020-02-27T22:44:15.600000Z</updated><author><name>jking22</name><uri>https://forge.codesys.com/u/jking22/</uri></author><id>https://forge.codesys.com8d7b0ba7542837f3a506547857c37f111a458a49</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Is there anyway of preventing write access to a VAR_IN_OUT variable inside the function block.&lt;/p&gt;
&lt;p&gt;i.e. is there some Codesys 2.3 or 2.5 eqiuvalent to the following in C++?&lt;/p&gt;
&lt;p&gt;void someFunction(const InputVariable&amp;amp;){...}&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;John&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>