P
Paul
You read the standards , please pay particular attention to the part thatJames Kanze said:"James Kanze" <[email protected]> wrote in messageOn
[...]
I'll repeat my suggestion. Read the C++ standard. And show me
where it defines an operator[] on an array.
I'm not wasting my time arguing with you over something that
is utterly and ridiculously obvious.
An array can be indexed. Learn to live with it, its never
gonna change.
Not in C++. (Well, std::array can be indexed.)Yes in C++. AN array can be indexed by subscripting.
Please stop making ridiculous statements that are untrue.
Read the standard. The standard explicitly says that the
operands to an [] operator must be a pointer and an integral
type. No array. This has been the case since K&R C, and none
of your claims to the contrary are going to change it.
states:
"Except where it has been declared for a class (13.5.5), the subscript
operator [] is interpreted in such a way
that E1[E2] is identical to *((E1)+(E2)). Because of the conversion rules
that apply to +, if E1 is an
array and E2 an integer, then E1[E2] refers to the E2th
member of E1."
So please stop making ridiculous statements that are simply untrue.
[] == oldarray[...]
[...]
int* arr1 = new int[12]; /*Create an array of 12 int*/
arr1[0] = 33;
int* arr2 = new(++arr1) int[11]; /*Create an sub-array within
original*/
You see. You even say so: new int[11] creates a new array of 11
ints, and returns a pointer to the first element of that array.
Not a pointer to arr1.
No I said I created an array of 12 ints, then I create and
sub-array within it, which returns a pointer with a value
identical to that of arr1.
You didn't create a subarray. You created a new array, using
some of the memory of the old one. (C++ doesn't have
"subarrays", although I guess you could call an array which is a
subobject of some larger object a subarray. That's not the case
here, however.)
So it's a sub array.
No. A sub array would be part of another object. In this case,
you've created a new top level object.No I managed the memory in such a way that i created an array
within an existing array.
Which formally at least causes the previously existing array to
cease to exist. At least according to the standard.
{} == new array
[][][][][][]{}{}{}{}{}{}{}{}{}{}{}[][][][][][][][]
If I create an array within another array as above. Only the elements that
are overwritten cease to exist, the elements not overwritten still exist
because I did not free the memory.
An array is a contiguous sequence of objects, not one single object(unless[...]But the whole object wasn't overwritten.
So you have a (small) part of the previous array? An object
either exists, or it doesn't.
its size is 0 or 1).