Subject:
|
NQC preprocessor behavior - constants evaluated?
|
Newsgroups:
|
lugnet.robotics.rcx.nqc
|
Date:
|
Mon, 16 Aug 2004 01:46:33 GMT
|
Viewed:
|
5501 times
|
| |
| |
Pardon a basic, low-level question, but I'm trying to minimize memory &
execution time. Does the NQC preprocessor precalculate constant expressions
before the compile pass? For instance:
#define CONST 100
#define HALF CONST/2
task main()
{
int x,y;
x = 3 * HALF;
y = 10 / 2 * x;
}
When this compiles, will the bytecode have the variable x assigned a single
constant, or will the bytecode actually be doing time (and memory) wasting
things like dividing 100 by 2 (in the second #define), or multipling a constant
by another constant (the assignment statement). And could it take the second
assignment statement and simplify it to a single math operation (5 * x).
Anybody?
--
Brian Davis
|
|
Message has 2 Replies:
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|