3 ms·
strcpy has no access to the "allocator". It doesn't know about malloc, realloc, or free.
by _RPM 9y ago
strcpy has no access to the "allocator". It doesn't know about malloc, realloc, or free.
- iainmerrick 9y agoYes -- and that has turned out to be a bad design decision. It's somewhat convenient to use methods like strcat() to build up strings, but it also leads to very insecure code. I think the inclusion of strdup() shows that it was a mistake to make C strings completely allocator-agnostic.