I have a program, written in C, which processes 24-bit audio samples and packs them into RTP packets for transmission across a network.
My code defines a 'sample' as a union of an int32_t and an array uint8_t[4] such that I can perform arithmetic operations on the whole sample, but also access its individual bytes for packing into the L24 encoding scheme specified in RFC3190.
This approach is working well on both ARM and Intel based systems, compiling with gcc. However, I'm concerned that some other compiler or architecture might pad the uint8_t elements and therefore break my program. Is this a valid concern? If so, is there a better way I could be handling the audio data?