OpenCyphal / libcanard

A compact implementation of the Cyphal/CAN protocol in C for high-integrity real-time embedded systems
http://opencyphal.org
MIT License
327 stars 192 forks source link

Eliminate one MISRA violation by replacing flex arrays with a safer alternative #183

Closed pavel-kirienko closed 2 years ago

pavel-kirienko commented 2 years ago

MISRA C prohibits flexible array members. Currently, we use flex arrays in one place here:

https://github.com/UAVCAN/libcanard/blob/5bf4c3c1add760a4fa7eb6d9a280dc9a20fa8c00/libcanard/canard.c#L122

It should be possible to replace that with a safer idiom suggested at http://www.open-std.org/Jtc1/sc22/wg14/www/docs/dr_051.html