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 / 1363
1362  |  1364
Subject: 
Re: maximum number of variables in RCX2 ?
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Wed, 20 Feb 2002 09:14:40 GMT
Viewed: 
3254 times
  
"John Guerquin" <jguerquin@sympatico.ca> writes:
When using the RCX2 target, the NQC manual (Section 2.2.4) states that 32
global variables, and 16 local variables (per task) are allowed.  Does • this
mean that the whole program can only have 48 variables total when using • only
one task, ie. "main" , and several functions?

The reason I ask this question, is that my understanding of local • variables
is that space is allocated only when the function has been called.  Once • the
function is complete, the memory that was used to store those local
variables is returned back to the 'memory pool'.  If anyone could clarify
the limitations of NQC variables, as well as how the limitations apply to
arrays, I would greatly appreciate it.

From my understanding of NQC, the compiler automatically selects the most
suitable location to store variables. Global variables are obviously always
allocated in one of the 32 global storage locations. Variables local to a
specific code block (task, function, sub) are automatically allocated from
the 16 local locations or the 32 global ones, though the location is
"released" and reused for other local variable after the code block ends. I
imagine that the compiler stores local variable in the local locations when
possible, but this is just an hypothesis :-)
NQC also allocates some temporary variable needed to store intermediate
results of expressions.

I'm not sure about how array storage space is allocated, but I suppose it
follows the same rules: global locations for global arrays, and (possibly)
local ones for local arrays.

Mario



Message is in Reply To:
  maximum number of variables in RCX2 ?
 
When using the RCX2 target, the NQC manual (Section 2.2.4) states that 32 global variables, and 16 local variables (per task) are allowed. Does this mean that the whole program can only have 48 variables total when using only one task, ie. "main" , (...) (23 years ago, 20-Feb-02, to lugnet.robotics.rcx.nqc)

5 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