Greets all, Another sequence of bads that cropped up using the Silicon Graphics MIPSpro compiler, any thoughts? To wit: cc-1028 CC: ERROR File = hyphenator.cc, Line = 147 The expression used must have a constant value. char chars [l + 1]; ^ cc-1028 CC: ERROR File = hyphenator.cc, Line = 185 The expression used must have a constant value. char noHyphens[len - 2 * breaks->size() + 1]; ^ cc-1028 CC: ERROR File = hyphenator.cc, Line = 185 The expression used must have a constant value. char noHyphens[len - 2 * breaks->size() + 1]; ^ cc-1060 CC: ERROR File = hyphenator.cc, Line = 185 The indicated operator is not allowed in an integral constant expression. char noHyphens[len - 2 * breaks->size() + 1]; ^ cc-1059 CC: ERROR File = hyphenator.cc, Line = 185 A function call is not allowed in a constant expression. char noHyphens[len - 2 * breaks->size() + 1]; ^ cc-1028 CC: ERROR File = hyphenator.cc, Line = 316 The expression used must have a constant value. char work[strlen (wordLc) + 3]; ^ cc-1059 CC: ERROR File = hyphenator.cc, Line = 316 A function call is not allowed in a constant expression. char work[strlen (wordLc) + 3]; ^ cc-1028 CC: ERROR File = hyphenator.cc, Line = 316 The expression used must have a constant value. char work[strlen (wordLc) + 3]; ^ 8 errors detected in the compilation of "hyphenator.cc". make: *** [hyphenator.o] Error 2
On Mo, Sep 02, 2013, Chris Sorenson wrote:
Greets all,
Another sequence of bads that cropped up using the Silicon Graphics MIPSpro compiler, any thoughts? To wit:
cc-1028 CC: ERROR File = hyphenator.cc, Line = 147 The expression used must have a constant value.
char chars [l + 1]; ^ [more similar cases]
It seems that your compiler does not support arrays with variable length, which are standard since C99, as far as I see. It could be fixed by replacing this line (as an example) by: char *chars = new char [l + 1]; and later delete[] chars; However, I'd like to check other possibilities. A short search lead me to <http://www.sgi.com/products/software/irix/tools/c.html>, according to which newer versions support C99. Which version do you use? Sebastian
participants (2)
-
csoren@isd.net
-
sgeerken@dillo.org