[Nickle]Re: initializer bug?
Bart Massey
nickle@nickle.org
Wed, 28 Aug 2002 22:57:40 -0700
Nevermind. Changing the initialization to
cell[size, size] cells = {
{(cell){val = cellval.BLANK, wall = (bool[4]){false ...}} ...}
...
};
seems to have done the trick. Frustrating that it has
enough information to typecheck but not to parse, though.
Bart
In message <E17kH7S-00019X-00@bart.cs.pdx.edu> you wrote:
> Attached is a code fragment initializing an array of
> structures containing an array: the initializer doesn't
> work. Is this a bug in my code, or in Nickle? I suspect
> the latter. (Additionally, why should Nickle need the
> "(cell)" in the initializer? It seems like it should be
> able to infer this from the lhs type, as does C, but it
> seems to get even more lost without it.)
>
> Thanks,
>
> Bart
>
> /*
> * Ricochet Robots solver
> * Bart Massey 2002/8
> */
>
> int size = 16;
>
> typedef enum {
> BLANK, ME, DRONE, TARGET
> } cellval;
>
> typedef struct {
> cellval val;
> /* 0 == N, 1 == E, 2 == S, 3 == W */
> bool[4] wall;
> } cell;
>
> cell[size, size] cells = {
> {(cell){val = cellval.BLANK, wall = {false ...}} ...}
> ...
> };
>
>
> _______________________________________________
> Nickle mailing list
> Nickle@nickle.org
> http://nickle.org/mailman/listinfo/nickle