To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 202
  Sharing variables and using expressions (was Re: NQC 2.0 and some math questions
 
I have discovered a somewhat non-intuitive feature of NQC (in my version, at least, which is pre-2.0) The statement: var = (20 * var) / 21; gets compiled into the following: MUL var, 20 ; var = var * 20 DIV var, 21 ; var = var / 21 rather than the (...) (25 years ago, 19-Oct-99, to lugnet.robotics.rcx.nqc)
 
  Re: Sharing variables and using expressions (was Re: NQC 2.0 and some math questions
 
The optimization was intentional (and quite a lot of work, actually). I know it breaks with multiple tasks, but I was more concerned with keeping the variable pool from being cluttered with temporaries. With only 32 vars to use, its quite easy to (...) (25 years ago, 20-Oct-99, to lugnet.robotics.rcx.nqc)
 
  Re: Sharing variables and using expressions (was Re: NQC 2.0 and some math questions
 
(...) I appreciate this -- that's what the "Not Quite" is all about. As long as you explain things well, I think this kind of compromise is the right way. (25 years ago, 20-Oct-99, to lugnet.robotics.rcx.nqc)
 
  Re: Sharing variables and using expressions (was Re: NQC 2.0 and some math questions
 
Thanks, Dave! It will be good to have that in the manual, because it is a very confusing behavior that is difficult to track down. Variables take on values that are completely different from the values that the programmer is setting them to. Most (...) (25 years ago, 1-Nov-99, to lugnet.robotics.rcx.nqc)

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR