- From: Nick <3-nospam@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 08 Jul 2010 06:28:36 +0100
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 | http://canalplan.eu
Plan trips, see photos, check facilities | http://canalplan.org.uk
- Prev by Date: Re: sequence points and expression evaluation
- Next by Date: Re: string literal initializer
- Previous by thread: Re: bcopy
- Next by thread: Re: bcopy