Hacker News new | ask | show | jobs
by dllthomas 4516 days ago
If you're able, don't treat text as zero-terminated char arrays. Ideally, you'd have a well fleshed-out library for encoding-aware ropes.
1 comments

Which libraries do you recommend?
Unfortunately, I don't know of one. My recent C work has worked with text only in a very limited capacity (parsing and building packets in an ascii format - for the later, vectorized write buffers are a poor-man's ropes).

Edited to add:

Apparently there is this: http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/cordh...

I recommend bstring for length-prefixed strings in C:

http://bstring.sourceforge.net/

Bstring relies on undefined behavior for security. Don't use it if you care about security.