Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Disadvantage #1 isn't really a disadvantage in modern computing, it's the right thing to do.


I strongly disagree. It is a tradeoff between that and advantages #1 and #3; with the bstring library, for example, you pass in a mutable string and the function mutates it.

In no world is passing in a mutable value, having it mutate it, but then having to reassigning your variable superior.

Passing in an immutable value, and then assigning a fresh value is reasonable, but that's not what SDS is doing, AFAICT.

I think gcc has some decorations you can have to tell it to never ignore the return function.

I'm curious why s = sdscat(s,"Some more data"); didin't end up like: sdscat(&s,"Some more data");




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: