octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #53128] Warn about implicit casts from int to


From: Michael Leitner
Subject: [Octave-bug-tracker] [bug #53128] Warn about implicit casts from int to double
Date: Tue, 13 Feb 2018 03:06:48 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #5, bug #53128 (project octave):

Generally, I'm also in favour of emitting warnings in situations that have
some significant probability of arising due to a user being not familiar with
every last clause of Octave/Matlab syntax. Whether this is the case here would
need to be discussed.

I think that performance would not be an issue. Remember that on the machine
code level, this kind of check obviously is done already now, as the processor
has to know how it has to interpret the contents of the memory addresses you
pass to it. So what would be needed is to check, once this branch is taken,
whether this warning is set, and if yes, to emit it. And remember further that
this has to be done only once per Octave-instruction. That is, in the double
for-loop in the toy test case below, it will very likely be submerged by the
effort  of the interpreter to parse the line once per iteration, while in a
matrix/matrix or matrix/scalar operation it has to be checked only once,
because each entry of such a numeric object has the same type. 

Perhaps there would be a performance hit when you use arrayfun on an internal
function, assuming arrayfun is efficient. No, I doubt it, consider


a=rand(1000,1000);
b=rand(1000,1000);
tic;c=a+b;toc
tic;c=arrayfun(@plus,a,b);toc


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53128>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]