Skip to content
Commit 4eb3db13 authored by Flavio Ceolin's avatar Flavio Ceolin Committed by Anas Nashif
Browse files

sys: util: Add macro to declare flexible arrays



Flexible arrays are arrays declared without a specific size, e.g:
uint8_t my_array[];

They are widely used as as last member in structs that are dynamically
allocated.

Since C99 they are part of the C standard, but for historical reasons
many places still use an older GNU extension that is declare zero
length arrays.

Although zero length arrays are flexible arrays, we can't blindly
replace [0] with [] because of some syntax limitations. This macro
workaround these limitations while get rid of this non standard
extension.

Using true flexible arrays allows the compiler to calculate the size
of the array better and improve potential issue checking.

Signed-off-by: default avatarFlavio Ceolin <flavio.ceolin@intel.com>
parent 4c541eb2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment