I am porting code from ew and gcc to keil uvision arm compiler (Arm compiler 5.06 update 1 build 61).
Both ew and gcc allow me to the following:
struct header { uint32_t chksum; uint8_t id; uint8_t size; /* This many bytes follow immediately */ uint8_t payload[]; /* Allows for easy access to the payload of variable size packets */ } struct datapacket { struct header header; uint64_t timestamp; uint8_t data[]; }
Is it possible to something similar with the arm compiler? I have enabled the C99 option which allows for empty array declaration but it does not seem to accept that the header has the empty array member payload[].
would have to refer back to standards to see whether it is strictly legitimate though.
It quite strictly is not. C99 forbids VLAs in nested structs.