News for hackers. Stuff that matters.
Re:Conflating pointers with arrays: C's biggest mistake? (2009) by tjoff on Sunday July 22, 2018 @04:30AM (#17585852)
> Strcpy has to iterate through all the elements because it copies them. This would happen regardless. It doesn't do strlen.

Iterate all the elements and copy a fixed size is two very different things.

strcpy has to read, byte for byte, and check it for null (which is exactly what strlen does). A "real" copy would just blindly copy a chunk of memory with no other processing on it. The speed difference is huge.

Re:Conflating pointers with arrays: C's biggest mistake? (2009) by WalterBright on Sunday July 22, 2018 @04:37AM (#17585864)
You're right. I apologize for using strlen metaphorically rather than literally.