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 / 1846
1845  |  1847
Subject: 
Re: Memory question
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Tue, 13 Dec 2005 22:17:41 GMT
Viewed: 
12012 times
  
In lugnet.robotics.rcx.nqc, Brian Davis wrote:

>    Most functions in NQC are in-line functions, so in a sense they probably
> *are* in main(). One thing I do is place all my initialization code (as much as
> possible) into in-line functions. That way, when the compiler runs through, it
> can allocate variable space as best it can, reusing variables in different
> functions as they fall in and out of scope. Saves me from running out of
> variables in some cases.

So what your saying is I should split my program into more functions not less,
so that the local ints are destroyed and available for re-use. That's a great
idea, it's the complete opposite of my question but fulfills my goal perfectly
:-).

> 
>    Another thing you can do is have a separate program do all your
> initialization, and then have the main program run "preinitialized" as it were
> (thanks SMART). The standard firmware doesn't zero-out global variables between
> runs, so *as long as the variable lists correspond*, the global variables
> initialized by one program will be accessible to another.

I'd never thought of that as a way of re-using variables before. I might try it
in future projects if need be.

Thanks

Steve



Message is in Reply To:
  Re: Memory question
 
(...) Most functions in NQC are in-line functions, so in a sense they probably *are* in main(). One thing I do is place all my initalization code (as much as possible) into inline functions. That way, when the compilier runs through, it can allocate (...) (21 years ago, 13-Dec-05, to lugnet.robotics.rcx.nqc)

3 Messages in This Thread:

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

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