Re: bcopy

Keith Thompson <kst-u@xxxxxxx> writes:

In earlier versions of C, only pointers and arithmetic types could be
assigned (see K&R1); neither arrays nor structs were first-class
types in that sense.

I'm pretty sure that the first version of C I used didn't allow structure
copying. I don't think anyone's mentioned it before you, but I do
wonder if that's behind whatever prompted the OP's question.

The ability to assign structs and to return them from functions was
added later (shortly after K&R1, I think); this was possible because
the new semantics didn't conflict with anything. But since array
expressions usually decay to pointers, there was no good way to add
array assignment to the language without breaking existing code.
For that matter, it wouldn't have been all that useful without a
lot of language redesign; most code that handles arrays needs to
deal with varying sizes.

The semantics argument is a good one and one I'd not thought of.
Online waterways route planner |
Plan trips, see photos, check facilities |