C's "flexible array members" are basically a convenient way to access a properly-aligned pointer to data after the struct:
struct s {
int len;
int data[];
};
In Rust we typically do:
struct S {
len: c_int,
data: [c_int; 0],
}
We have a handful of tests that are related to FAM not being supported, e.g.
|
// The following types contain Flexible Array Member fields which have unspecified calling |
|
// convention. The roundtripping tests deliberately pass the structs by value to check "by |
|
// value" layout consistency, but this would be UB for the these types. |
|
"inotify_event" => true, |
|
"fanotify_event_info_fid" => true, |
|
"cmsghdr" => true, |
|
"bcm_msg_head" => true, |
|
|
. I think this should be pretty easy to start supporting.
Cc of course @mbyx
C's "flexible array members" are basically a convenient way to access a properly-aligned pointer to data after the struct:
In Rust we typically do:
We have a handful of tests that are related to FAM not being supported, e.g.
libc/libc-test/build.rs
Lines 5338 to 5345 in 93a17ee
Cc of course @mbyx