User talk:Dinosaur: Difference between revisions

Line 62:
::But yes, I'll admit that I think that short-circuit evaluation is correct, and that code that works with that is correct (especially when it is tested and works correctly), and that the order of evaluation of expressions is fully defined (tie-breaker rule: left-to-right for equal precedence), and I resist the more recent Fortran specifications whereby, maddeningly, it is specified that this is not specified. Because I think that is incorrect... Time for a drink. Cheers, [[User:Dinosaur|Dinosaur]] ([[User talk:Dinosaur|talk]]) 02:26, 31 December 2017 (UTC)
:::There is already a task about '''[[Short-circuit evaluation]]'''. You are free to read it, or not, but do not claim you are left alone in a fog. Anyway, the standard has not changed much since the 1978 flavor: "It is not necessary for a processor to evaluate all of the operands of an expression if the value of the expression can be determined otherwise." (Fortran 77, section 6-20). It is permitted, but not mandatory, hence you can't count on it. Anyway, the order of evaluation is not guaranteed either. A program that relies on short-circuit evaluation is not standard conformant, and it has never been. A compiler may provide such a feature ''and document it'', but I know no example. Have a look at [https://gcc.gnu.org/ml/fortran/2007-03/msg00368.html this] for gfortran, for instance. Now, you are free to write buggy code which happens to work sometimes, you may even be proud of it. Who cares? [[User:Eoraptor|Eoraptor]] ([[User talk:Eoraptor|talk]]) 13:37, 31 December 2017 (UTC)
::::And I suppose it's not worth mentionning that syntax like "INTEGER*1" is not standard conformant either (and has never been). There are probably other nonstandard "features" you are proud to (ab)use, and you probably think it makes you look like a good Fortran programmer. [[User:Eoraptor|Eoraptor]] ([[User talk:Eoraptor|talk]]) 13:43, 31 December 2017 (UTC)
1,336

edits