message--What's wrong with saying that an array object is what it actually is,
--*plus* it has the useful property that the operation &a[0] is
--automatically applied wherever needed. E.g.,
Well I have been saying that it is an array type object but nobody accepts
that an array type objects exists. As it is written in the standard as a
non
modifiable object of array type , perhaps my terminology is not 100% the
same as the standards but I see no idfference in the two terms
1) array type object
2) object of array type.
--I now see what you're saying. You are simply wrong.
About what exactly?
-- void f()
-- {
-- int x[3];
-- }
--That allocates a piece of memory on the stack. (At least for all
--common implementations which happen to use stack.) That region of
--memory, which contains 3 contiguous int sub-objects (barring padding),
--is a single object. That is the array object. The array object
--contains the 3 int sub-objects. The array object is not some object
--distinct from the 3 int objects. The array object and the 3 int
--objects occupy the same region of memory. The 3 int objects are sub-
--objects of the array object. It behaves very similar to:
-- struct x_t { operator int* (); private: int x0; int x1; int x2; }
-- x_t x;
You have not described a non modifiable object, you have described 3 integer
objects that are modifiable.
This object you have described can be modified bit by bit , there is no way
this object can be said to be a non modifiable array type object.
The only non modifable object here is the object represented by the
identifier arr. This object holds a vlaue that is a memory address and this
value is not stored with the array of three integers. That means this object
is an object in its own right that takes up memory over and above the memory
used for the 3 integer objects.
--Array objects are not modifiable. That was not intended to mean that
--the memory of the object cannot change. It was a shorthand for several
--facts about the type system, including expressions of array type may
--not appear on the left hand side of built-in assignment operators.
What is means is that the value of an array type object cannot change , that
value is the address of the initial element of the array.
--The memory of the array object may change, but only through
--expressions of the element type, not the array type. (Or char or
--unsigned char, or memcpy, etc.)
What do you mean by the memory of the array object?
Do you mean the memory that holds the address of the first element , or the
memory that holds the values stroed in the elements?