logoalt Hacker News

teo_zeroyesterday at 10:23 PM1 replyview on HN

You can surely create a std::string-like type in C, call it "newstring", and write functions that accept and return newstrings, and re-implement the whole standard library to work with newstrings, from printf() onwards. But you'll never have the comfort of newstring literals. The nice syntax with quotes is tied to zero-terminated strings. Of course you can litter your code with preprocessor macros, but it's inelegant and brittle.


Replies

krapptoday at 12:20 AM

Hacker News seems not to hate antirez's sds

https://github.com/antirez/sds

https://news.ycombinator.com/item?id=45014911

show 1 reply