Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
Zero-length arrays in C: A cautionary tale
(opens in new tab)
(shivankaul.com)
3 points
skaul
8y ago
2 comments
Save
Share
2 comments
2 comments · 1 top-level
top
newest
oldest
gonzerelli
8y ago
· 1 in thread
You can static assert that the offset of your VLA member is the size of your structure. I haven't thought about alignment requirements, but for many needs it will do the job.
skaul
OP
8y ago
Good idea. The issue I guess in this case was more that we weren't originally using a VLA member but a zero-length array through a language extension.
j
/
k
navigate · click thread line to collapse