Skip to content

Comment on Never create Ruby strings longer than 23 charactersparent

Comments

but as far as I can tell, Ruby doesn't rely on this directly

They may be null-terminated to make writing C extensions easier. If they weren't, you'd have to make a null-terminated copy every time you wanted to pass the bytes to a function expecting a null-terminated string, which most C APIs do.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.