You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now an InlineString is not C-compatible because there is no null trailing byte (in the case of all characters occupying the string) because the last byte stores the length of the string. There is a trick where, instead of storing the length of the string in the last byte, you store "the space left in the string", so if the max chars is 31 and you have 10 characters, you store 31 - 10 = 21 in the last byte. The point being that in the case of the string being full you would store a 0 there which would double-dip as the capacity left (which is zero) AND the trailing null byte making the string C-compatible.
This would allow wrapping an InlineString in a Ref, taking a pointer and passing it to a standard C-string function. And Julia will likely optimize away the Ref allocation.
Reacted by Milan Bouchet-Valat, Casey Kneale, Matt Bauman and Alex Arslan
Activity
caseykneale commentedon Mar 18, 2022
bkamins commentedon Mar 18, 2022
Stop special casing `InlineString1`
Stop special casing `InlineString1`
Stop special casing `InlineString1`
Stop special casing `InlineString1`
Stop special casing `InlineString1`
Stop special casing `InlineString1`
Stop special casing `InlineString1`
Stop special casing `InlineString1`
Stop special casing `InlineString1`
Stop special casing `InlineString1` (#80)
Stop special casing `InlineString1`
quinnj commentedon Sep 4, 2026
Implemented in #94 for 2.0.