spillerrec wrote:You can't apply the static keyword on the temporary variables...
Then the "staticness" should be inherited by the "temporary" variables...? Besides, "performance" won't decrease by any distinguishable amount - the memory will be reallocated anyways when you reuse the "temporary" variables.
The compiler creates quite a bit of those temporary strings and similarly it would need to create just as many ArrayInit statements plus for all the manually declared strings. It can easily end up being quite a bit, just look how strcat adds 3 strings that will not be reused for other string operations...
I will never get satisfied anyway, I should just get used to write NBC instead...
[quote=muntoo]Doesn't work if I use static int counter = 1; ++counter; (It always equals two for some reason! )[/quote]You also want initialized static variables? You sure are demanding! : P
John, could you pls change the weird sensor functions?
that is horrible and confusing and weird.
Please sacrifice those weird and odd definitions.
Most of all I would like to have a standard function
void InitSensor(port, SensorType) (or SensorInit) where SensorType is ANY type (analog, i2cLS, i2cHS and RS485) (i2cHS for future like implemented by RobotC).
No more SensorTouch, SensorLowSpeed, SensorTemperature, SensorLightActive and all that. You may transfer them to kind of sensor types, not sensor initializing functions.
Then I'd wish to have
SensorValue(port, &value[]) which returns one or more dimensional sensor values, if not specified then the real raw values like the former SensorRaw() (0-1023)
Then I wish to have a
SensorUnit(port)
which may specify specific units like percent, inverse raw( 1023-0), touch, pulse, edge, normalized or scaled (what ever the latter 2 might be - i'm not supposed to use them EVER) .
That would make the usage VERY much more transparent and logical.
I know that this is VERY much non-Lego-like but very much comfortable for users for the future (legacy functions could be kept unducumented until extincted some day)
another issue:
global variable names should be modified by the NBC preprocessor (or however it is called) to get an underline NBC prefix (or postfix) _
because there are compiler issues with a global NXC variable e.g. called
int index;
IMHO the results of array statistics "mean" and "standard deviation" should be calculated always as floats independently from the value type of the samples
(if one wants to have them as ints one may round or truncate them)
I would appreciate to have a more efficient memory management concerning local variables passed to functions by reference.
(Having pointers would be very efficient)
doc-helmut wrote:I would appreciate to have a more efficient memory management concerning local variables passed to functions by reference.
(Having pointers would be very efficient)
When you have added support for pointers/references in the NXT firmware I will begin the arduous task of supporting that new variable type in NXC. I am not planning at all to drive myself crazy trying to make those kind of firmware changes.