3 ms·
strcpy and friends don't really have any benefits beyond just being there. The "safer" versions are still unsafe in many cases, while being less performant and
by sirwhinesalot 3y ago
strcpy and friends don't really have any benefits beyond just being there. The "safer" versions are still unsafe in many cases, while being less performant and more annoying to use.
Writing a strbuffer type and associated functions isn't particularly hard and the resulting interface is nicer to use, safer, and more efficient.
- bvrmn 3y agoI argue strview (non-owning) is almost always what is needed. Most of string operations are searching and slicing.
- sirwhinesalot 3y agoYou also need a strview. Not really relevant for avoiding strcpy and strcat though.