4 ms·
Those functions could be easily done via syscalls to the underlying OS or simple Assembly routines, as they are quite simple to implement. None of those four f
by colanderman 13y ago
Those functions could be easily done via syscalls to the underlying OS or simple Assembly routines, as they are quite simple to implement.
None of those four functions use syscalls, nor are any of them simple to implement efficiently in assembly.
Consider that memcpy, under GCC,
* generates different code based on any known alignment of the source or destination
* generates simpler code if the size is known at compile time
* generates only register accesses if one or both of the arguments live in registers
* is elided entirely if GCC determines that it may do so safely
The other three have similar complex behavior. The Rust developers didn't use them just because they were too dumb to know how to write a for loop in assembly.
- pjmlp 13y agoSimple is not the same as easy. Anyone with compiler development experience can implement them without much trouble, hence simple. Sadly that is a skill many seem to lack nowadays.
- Confusion 13y agoYeah, back in the old days everyone had that kind of compiler development experience, didn't they?
- pjmlp 13y agoCompared to what kids seem to know nowadays, yes. They can grok HTML5 page full of JavaScript stuff, but then mix language with implementation, think that strong typing is only possible with VM based languages and faith at the look of Assembly code.