OSCAT Forum

oscat.lib => oscat.lib fuer TwinCAT/CoDeSys => Thema gestartet von: shooter am 20. Februar 2011, 19:50:50

Titel: declare variables
Beitrag von: shooter am 20. Februar 2011, 19:50:50
i would like to opt for declare variables for some as i see a lot of 0.0 and 1.0 in the lib.
o would like to put them as
zero : real:=0.0;
one : real:=1.0;
hundred :real:=100.0;
etc

inside a function declare them, this to avoid calc errors with int and real all over the place.
or global

the place where is a discussion i would like to have here.
so just vote for local inside a function or function block or global.
Titel: Re:declare variables
Beitrag von: hugo am 20. Februar 2011, 21:43:09
why would you expect calculation errors if we declare the variables differently? using number constants is leading to exactly the same result, while the compiler is doing the job.