haoayou 发表于 2024-7-10 18:16:53

SCL的赋值运算符确实和LAD的Move的区别

<p style="box-sizing: border-box; font-family: &quot;Noto Sans SC&quot;, &quot;Microsoft YaHei&quot;, ΢���ź�, -apple-system, BlinkMacSystemFont, &quot;segoe ui&quot;, Roboto; padding: 0px; margin-top: 0px; margin-bottom: 0px; color: rgb(0, 0, 40); text-align: justify; font-size: 14px; line-height: 26px;">SCL的赋值运算符确实和LAD的Move有区别,</p><p style="box-sizing: border-box; font-family: &quot;Noto Sans SC&quot;, &quot;Microsoft YaHei&quot;, ΢���ź�, -apple-system, BlinkMacSystemFont, &quot;segoe ui&quot;, Roboto; padding: 0px; margin-top: 0px; margin-bottom: 0px; color: rgb(0, 0, 40); text-align: justify; font-size: 14px; line-height: 26px;">MOVE更倾向于底层位串的复制,而 := 和算术复制相当,需要考虑数据类型,如果类型不一致,除了隐式转换的情况外需要手工转换数据类型,匹配了才能:=。</p><p style="box-sizing: border-box; font-family: &quot;Noto Sans SC&quot;, &quot;Microsoft YaHei&quot;, ΢���ź�, -apple-system, BlinkMacSystemFont, &quot;segoe ui&quot;, Roboto; padding: 0px; margin-top: 0px; margin-bottom: 0px; color: rgb(0, 0, 40); text-align: justify; font-size: 14px; line-height: 26px;">:= 是值赋值,位串表示的Dword的数值显然不等于需要的Real值,如果强行:=,则只会把整数简单转换为浮点数,就像21转换为21.0一样。</p><p style="box-sizing: border-box; font-family: &quot;Noto Sans SC&quot;, &quot;Microsoft YaHei&quot;, ΢���ź�, -apple-system, BlinkMacSystemFont, &quot;segoe ui&quot;, Roboto; padding: 0px; margin-top: 0px; margin-bottom: 0px; color: rgb(0, 0, 40); text-align: justify; font-size: 14px; line-height: 26px;">如果打开IEC检查,MOVE也和:=一样需要类型匹配才能Move。</p><p style="box-sizing: border-box; font-family: &quot;Noto Sans SC&quot;, &quot;Microsoft YaHei&quot;, ΢���ź�, -apple-system, BlinkMacSystemFont, &quot;segoe ui&quot;, Roboto; padding: 0px; margin-top: 0px; margin-bottom: 0px; color: rgb(0, 0, 40); text-align: justify; font-size: 14px; line-height: 26px;"><br/></p><p><br/></p>
页: [1]
查看完整版本: SCL的赋值运算符确实和LAD的Move的区别