> writearr should point to a one-member const unsigned char array, and the
> zeroth element of that array has the value JEDEC_WREN.
=
it's not clear to me that c99 allows one to declare an unnamed array
and assign a pointer to it in this way except if the array is a char* or
wchar_t*.

i think the cleanest approach to solving your problem is
to define writeattr as an array, not a uchar*.

- erik

----
8c -FVTw cdha.c
8l -o 8.cdha cdha.8

#include <u.h>
#include <libc.h>

enum{
        Jwren   = 0x06,
};

typedef struct Spicmd Spicmd;
struct Spicmd{
        uchar   writearr[5];
};

void
main(void)
{
        Spicmd cmds[] = {
                {
                .writearr               = {Jwren, },
                },
        };

        print("writearr=%p\n", cmds[0].writearr);
        print("writearr[0]=%#.2hhx\n", cmds[0].writearr[0]);
        exits("");
}

Reply via email to