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 / 508
507  |  509
Subject: 
Re: Modulo operator in NQC
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Fri, 31 Mar 2000 00:25:35 GMT
Viewed: 
3129 times
  
In article <38E2BBB4.FE4D7FA3@SPAM.netstrata.com>, Dennis Williamson
<dennis.NO@SPAM.netstrata.com> wrote:

I'm trying to use the modulo operator in NQC, but I get an error that it
expects constants. I checked the docs and that indeed seems to be the
case. While I'm sure there must be instances where one would use
constants on both sides of the operator, I can't think of any. To not
allow variables seems to be eliminating the main usefulness of this
operator.

The limitation is more historical than anything else.  Originally
expressions were all evaluated at compile time, which is why I have a
bunch of operators (%, >>, <<) that have no corresponding bytecodes in
the firmware.

Over the last few versions of NQC, code generation has gotten a bit more
sophisticated (including allocation of temporary variable, etc) so
operations which had corresponding bytecodes (+, -, etc) could be
generated.

Its actually possible to generate a sequence of instructions for modulo
(div, mul, sub).  Not efficient, and burns a temp, but still possible.
I've got the basic code working, so it should appear in the next version.

Perhaps pointers are the answer. Does NQC support pointers?
Obviously I'm just learning about NQC.


Sorry, no pointers.  The firmware is *very* limiting.  No locals,  no
stack, no pointers, etc.

Dave Baum

--
reply to: dbaum at enteract dot com



Message is in Reply To:
  Modulo operator in NQC
 
I'm trying to use the modulo operator in NQC, but I get an error that it expects constants. I checked the docs and that indeed seems to be the case. While I'm sure there must be instances where one would use constants on both sides of the operator, (...) (25 years ago, 30-Mar-00, to lugnet.robotics.rcx.nqc)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

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