3 ms·
man 3 strdup. Why is this upvoted? If you are a new programmer, don't read this nonsense.
by nbw310 8y ago
man 3 strdup. Why is this upvoted? If you are a new programmer, don't read this nonsense.
- mwcampbell 8y agoIt's true that on platforms where strdup is supported, the C example could be written more succinctly with strdup. But strdup isn't part of the ANSI/ISO standard, at least according to the man page on Ubuntu 16.04. And even when using strdup, you can't get away from manual memory management; you still have to call free (or strfree) afterward. Furthermore, the field of programming is so vast that it's unreasonable to expect someone to know every nuance of a given language, especially if it's one that they don't use heavily. So I don't think there's any good reason to dismiss the whole article as nonsense.