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 | http://canalplan.eu
Plan trips, see photos, check facilities | http://canalplan.org.uk
.



Relevant Pages

  • Re: why cannot assign to function call
    ... understand how assignments work in these languages, ... as in Python, Java, REALbasic, .NET, etc. ... Arrays are the only datatype in C that don't use ... Python's assignment semantics, and further appear ...
    (comp.lang.python)
  • Re: malloc creates seg faults?
    ... > for duplicating arrays of some objects. ... > the required memory, ... retval does not point to Product here as there malloc returns raw memory. ... As *p is not a Product this assignment is meaningless. ...
    (comp.lang.cpp)
  • Re: Unknown size
    ... For arrays of size 3 or so, it must be a killer on any particular assignment, but how about globally for a whole program? ... We did have customers who complained about their programs getting slower due to this check, so it seems to be real, especially when the assignment is in a loop. ... User communities for Intel Software Development Products ...
    (comp.lang.fortran)
  • Re: why cannot assign to function call
    ... other types (disputedly except arrays) are. ... One can then use that pointer to manually effect ... to wrap your brain around than that of other languages. ... and read wild claims that Python's assignment and parameter-passing ...
    (comp.lang.python)
  • Re: setting object properties for object array in 2008a obj model
    ... The class has a single property, Tag, and set.Tag & ... For arrays, the getter works fine. ... My problem is assignment. ...
    (comp.soft-sys.matlab)