Home/Support/Support Forum/howto initialize a large array (4096 float elements) when "not enough memory for long line"
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

howto initialize a large array (4096 float elements) when "not enough memory for long line"

0 votes
Hi,

I'm using Dynamic C V10.70 on Win XP for a RCM6700 target.
I'm trying to initialize a large float array as follow :

far float crosstable[4096]={\
-250.000,-249.622,-249.244,-248.897,-248.606,-248.315,-248.025,-247.753,\
-247.483,-247.213,-246.950,-246.714,-246.477,-246.241,-246.005,-245.782,\
-245.560,-245.337,-245.115,-244.904,-244.705,-244.506,-244.307,-244.108,\
-243.914,-243.725,-243.536,-243.347,-243.158,-242.970,-242.790,-242.610,\
-242.430,-242.250,-242.070,-241.895,-241.723,-241.551,-241.380,-241.208,\
-241.036,-240.870,-240.706,-240.541,-240.377,-240.213,-240.048,-239.884,\
and so on until the last array element.

The compiler gives me the following message :
"not enough memory for long line"

I suppose it is a compiler line size limitation ? Am I true ?
Can it be changed ?

Thx.
asked Jun 16, 2015 in Rabbit Software by regis.schmidt New to the Community (2 points)

Please log in or register to answer this question.

2 Answers

0 votes
You just remove backslash from array, and everything worked.
Code:
far const float crosstable[4096]= {-250.000,-249.622,-249.244,-248.897,-248.606,-248.315,-248.025,-247.753, -247.483,-247.213,-246.950,-246.714,-246.477,-246.241,-246.005,-245.782, -245.560,-245.337,-245.115,-244.904,-244.705,-244.506,-244.307,-244.108, -243.914,-243.725,-243.536,-243.347,-243.158,-242.970,-242.790,-242.610, -242.430,-242.250,-242.070,-241.895,-241.723,-241.551,-241.380,-241.208, -241.036,-240.870,-240.706,-240.541,-240.377,-240.213,-240.048,-239.884 }; void main() { int i; for(i=0; i<sizeof(crosstable); i++) { printf("%.3f\t", crosstable[i]); } }
answered Jun 25, 2015 by edha Community Contributor (71 points)
0 votes
It works perfectly. In the past I used another compiler which force a single line written on multi lines to be ended by a backslash. Removing the backslashes in Dynamic C solve the problem.

Thx a lot.

Regards.
answered Jun 26, 2015 by regis.schmidt New to the Community (2 points)
...