[NXT] Cannot initialize empty list in NXC
Describe the bug
Originally, this ticket was about expanding a list in NXC, but then I noticed, this starts even earlier:
Orlab allows me to initialize a variable with an empty list.
This doesn't work in the generated NXC code as its ArrayBuild function expects the array to fill and at least one element.
I'd therefore expect either not being able to create an empty list in orlab or to convert it to a construct in NXC that emulates the desired behaviour.
To Reproduce Steps to reproduce the behavior:
-
Write a program like the following:

-
Run it in the simulator
-
Be happy that it works
-
Try to send it to the brick
-
Get a compiler error
The generated NXC code:
#define WHEELDIAMETER 5.6
#define TRACKWIDTH 12.0
#define MAXLINES 8
#include "NEPODefs.h" // contains NEPO declarations for the NXC NXT API resources
float numbers[0];
task main() {
float __numbers[] = {};
numbers = __numbers;
SetSensor(S1, SENSOR_TOUCH);
SetSensor(S2, SENSOR_SOUND);
SetSensor(S3, SENSOR_LIGHT);
SetSensor(S4, SENSOR_LOWSPEED);
TextOut(0, (MAXLINES - 1) * MAXLINES, "Hallo");
}
The compiler error:
# Error: Invalid number of arguments: at least 2 expected, 1 found
File "/home/pi/workspace/bug_expand_empty_list.nxc" ; line 8
# arrbuild __main_7qG2___numbers_7qG2_000
Expected behavior The program compiles.
- Initialisation of arrays with zero elements should (and will) be removed from blockly for nxt.
What is the current state of this issue?