Re:Rust: Not So Great For Codec Implementing
by camgunz on Tuesday August 01, 2017 @02:18PM
(#14903697)
I can't speak for the author of course, but probably their argument is that a systems language should be able to directly manipulate bits and bytes without outside dependencies. I don't know that I agree. A reasonable counter example is that you need library support to allocate memory in C. The argument is that it's a feature to not require C implementations to include dynamic memory allocation because not all projects allow it. My point being that what "should" be in a language usually depends on what you're using it for, and for a general purpose language keeping that very small is at least a consistent design.
[ Parent
| on HN ]
Re:Rust: Not So Great For Codec Implementing
by benlorenzetti on Tuesday August 01, 2017 @08:31PM
(#14906803)
You don't need a library to allocate memory in C. For example on Linux, use sbrk() system call to grow the heap, then start using it.
But your larger point still stands.
Re:Rust: Not So Great For Codec Implementing
by Sharlin on Wednesday August 02, 2017 @12:52AM
(#14908012)
I think that the point was more that heap allocation is not a standard language primitive in C. And indeed, it would be ludicruous to require dynamic allocation support from freestanding implementations (no standard library because typically your platform doesn't even have an OS).
Re:Rust: Not So Great For Codec Implementing
by Sprocklem on Thursday August 03, 2017 @10:35AM
(#14919923)
For what it's worth, C++ can have freestanding implementations and it provides dynamic allocation support at a syntactic level. Freestanding applications, however, need to provide an "operator new" function (with the appropriate memory allocation code) if they want to use it.
Re:Rust: Not So Great For Codec Implementing
by benlorenzetti on Wednesday August 02, 2017 @01:30AM
(#14908160)
Ah sorry camgunz I interpreted the counter example as claiming malloc() was a dependency. referencing the wrong subject!