3 ms·
The good thing about C is that, while its memory management is unsafe, it is at least explicit; there's generally no doubt as to whether a statement allocates m
by jasonhansel 4y ago
The good thing about C is that, while its memory management is unsafe, it is at least explicit; there's generally no doubt as to whether a statement allocates memory or not, since "malloc" and "free" have to be written out explicitly in the code.
The same cannot be said for C++.
- robotresearcher 4y agoVarious stdlib functions allocate heap memory without a visible malloc().
- steveklabnik 4y agoOr even, uh... shell out to perl https://github.com/Apple-FOSS-Mirror/Libc/blob/2ca2ae74647714acfc18674c3114b1a5d3325d7d/gen/wordexp.c#L192 https://github.com/Apple-FOSS-Mirror/Libc/blob/2ca2ae7464771...
- SubjectToChange 4y agoThe behavior of malloc and free often isn’t explicit.