"initializer for integer value is too complicated" and arm-wince progress
Chad J
gamerChad at _spamIsBad_gmail.com
Fri May 12 01:10:28 PDT 2006
In my port of gphobos to PocketPC, I have run into this error that the
compiler throws:
initializer for integer value is too complicated
I was wondering if anyone else has run into this error. If so, I am
also hoping for advice on how to make it go away. I suspect it is some
kind of compiler error and I have no idea what it's origins are.
I have run into this on both gcc 3.3.3 and gcc 3.4.6.
It seems to trigger under one of at least two conditions: rectangular
array initialization, and variadic functions.
float[][] blah = [[1]]; // causes error
char[][] strings = ["value"]; // causes error
struct something { char[] value; }
something[] ident = [{"foo"}]; // causes error
The rectangular arrays are annoying but don't bug me so much because I
can work around that. The following code:
struct something { char[] value; }
something[] ident;
static this()
{
something toAdd;
toAdd.value = "foo";
ident ~= toAdd;
}
... works fine.
Variadic functions though, would require a rewrite of how the library is
used in order to be worked around, unless I am ignorant of a good hack.
Here is a variadic function that triggers the error:
void va(...) {}
void somefunc()
{
// each of these calls would cause an error
va("arg1","arg2");
va(27,76);
}
OK now for some good news. In an attempt to escape this by changing to
a different gcc version, I have managed to go from gcc version 3.3.3 to
3.4.6 as my cross compiler. I've tried 4.0.3 before and run into nasty
assembler errors, which I never bothered to sort out. 3.4.6 was just a
matter of making the compiler dump it's specs file and then merging in
necessary changes from the previous specs file. There might have still
been some rough edges in the specs file, so I needed to change #if
_WIN32 into #ifdef _WIN32 in two files: internal/critical.c and
internal/monitor.c. Hope that's alright.
Also I'd like to mention my progress. I think make is about halfway
done compiling the phobos source files into object files. Not sure if
anything comes after that, besides debugging and a great struggle to
make it directory-independent, for better binary distribution, if that
even makes sense. IMO this thing SHOULD be binary distributed (in
addition to source, of course) when completed, because building it is a
pain.
More information about the D.gnu
mailing list