stf on Nostr: i feel like VLA in structs is actually a good thing in very specific conditions. I ...
i feel like VLA in structs is actually a good thing in very specific conditions. I have to construct a blob that contains - among others - multiple length-prefixed string components, why cannot i declare a const fn local struct variable that is immediately initialized? instead i have to calculate the final size of a buffer myself, and then do ptr acrobatics to memcpy() everything in place, or ugly macros. the former is easy to understand and audit, the latter are a nightmare in comparison.
#c
Published at
2026-10-21 20:58:06 UTCEvent JSON
{
"id": "8e8482552aa968310ec94d8297560d32af5b504d02a571a22f8575060b11f797",
"pubkey": "b887bffcf63863763c712604944ba34cf6b4674aba9d9ad586fda383be9f07c8",
"created_at": 1792616286,
"kind": 1,
"tags": [
[
"t",
"c"
],
[
"proxy",
"https://chaos.social/users/stf/statuses/117480900933668255",
"activitypub"
],
[
"client",
"Mostr",
"31990:6be38f8c63df7dbf84db7ec4a6e6fbbd8d19dca3b980efad18585c46f04b26f9:mostr",
"wss://relay.ditto.pub"
]
],
"content": "i feel like VLA in structs is actually a good thing in very specific conditions. I have to construct a blob that contains - among others - multiple length-prefixed string components, why cannot i declare a const fn local struct variable that is immediately initialized? instead i have to calculate the final size of a buffer myself, and then do ptr acrobatics to memcpy() everything in place, or ugly macros. the former is easy to understand and audit, the latter are a nightmare in comparison.\n\n#c",
"sig": "d9a857375222235e15579d68b8dddb087712e1641a1cc1fd29b0f7c9fb93d369b56188068b26654a7f62867a9a3f18d3041a4cfb42d45401e6b292cbb61569a3"
}