Re:Conflating pointers with arrays: C's biggest mistake? (2009)
by WalterBright on Sunday July 22, 2018 @04:49AM
(#17585891)
To illustrate the advantage of memcpy, consider this inner loop possible implementation:
Modern processors can likely do the 4 loads and 4 stores in parallel. That can't be done with 0 terminated strings, as you have to check every byte for 0. Even worse, you have to take care not to seg fault by reading too far past the 0, as there may not be any valid memory there.
[ Parent
| on HN ]