size_t count = vec_size(self->initlist);
size_t i;
+ if (count > self->expression.count) {
+ compile_error(ast_ctx(self), "too many elements in initializer");
+ count = self->expression.count;
+ }
+ else if (count < self->expression.count) {
+ /* add this?
+ compile_warning(ast_ctx(self), "not all elements are initialized");
+ */
+ }
+
for (i = 0; i != count; ++i) {
switch (self->expression.next->vtype) {
case TYPE_FLOAT:
-I: arrays.qc
-D: array accessors and functionality
+I: arrays2.qc
+D: initialized arrays
T: -execute
C: -std=fteqcc
-M: 1001 1101 1201 1301 1401 1501
-M: 1001 1101 1201 1301 1401 1501 1601
-M: 1001 1101 1201 1301 1401 1501
+M: 10 20 30 40 50 60 70
+M: 100 200 300 400 500 600 0
--- /dev/null
+float glob1[7] = { 10, 20, 30, 40, 50, 60, 70 };
+float glob2[7] = { 100, 200, 300, 400, 500, 600 };
+
+void main() {
+ float i;
+ print(ftos(glob1[0]));
+ for (i = 1; i != 7; ++i)
+ print(" ", ftos(glob1[i]));
+ print("\n");
+
+ print(ftos(glob2[0]));
+ for (i = 1; i != 7; ++i)
+ print(" ", ftos(glob2[i]));
+ print("\n");
+}
--- /dev/null
+I: arrays.qc
+D: array accessors and functionality
+T: -execute
+C: -std=fteqcc
+M: 1001 1101 1201 1301 1401 1501
+M: 1001 1101 1201 1301 1401 1501 1601
+M: 1001 1101 1201 1301 1401 1501