← Back to context

Comment by orwin

2 years ago

Honestly just use memcopy and define your own string structure.

C has void*, that allows you to implement easily modifiable data structures. There is a bit of 'NIH' syndrome in what I'm saying, I'll admit, but in the end it's better imho.

C is all about memory management and copying data around, and people can't stop whining that there is no magic string handling sauce (as if strings were special), and keep acting like we had to put up with the ridiculous strcat() etc. nonsense.

That's not what 'void*' is for.

  • That's how I use it though. As a data-agnostic type, so I can put whatever I like in my btrees/buffers/linked lists.

    I don't use it for string management, I guess reading my post again, I expressed myself poorly, again.