Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > delete[] p or delete[] *p

Reply
Thread Tools

delete[] p or delete[] *p

 
 
Goran
Guest
Posts: n/a
 
      04-19-2011
On Apr 17, 7:28*pm, "Paul" <(E-Mail Removed)> wrote:
> Eh!? No, you presented no evidence. You __misinterpreted__ an
> interview and a part of the standard.
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> No I quoted some text from websites, no interview misquotations.


Quotes are correct, your __interpretation__ is wrong.

> the standard clearly states that
> pointer representation of arrays are (n-1) dimensional.


Standard does no such thing. not. You made a leap from "array of
dimension n, when it appears in an expression, is __converted__ to a
pointer to an array of the dimension n-1. The opposite is not true,
and standard does not say that. You are misinterpreting that passage.

Goran.
 
Reply With Quote
 
 
 
 
Paul
Guest
Posts: n/a
 
      04-19-2011

"Goran" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
On Apr 17, 7:28 pm, "Paul" <(E-Mail Removed)> wrote:
> Eh!? No, you presented no evidence. You __misinterpreted__ an
> interview and a part of the standard.
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> No I quoted some text from websites, no interview misquotations.


Quotes are correct, your __interpretation__ is wrong.

> the standard clearly states that
> pointer representation of arrays are (n-1) dimensional.


Standard does no such thing. not. You made a leap from "array of
dimension n, when it appears in an expression, is __converted__ to a
pointer to an array of the dimension n-1. The opposite is not true,
and standard does not say that. You are misinterpreting that passage.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Yes so if we convert an array to a pointer , the resulting pointer is a
pointer to an (n-1) dim array.
So now we have a pointer to the array, the pointer-type just happens to be
type pointer to (n-1) dim array.

 
Reply With Quote
 
 
 
 
Goran
Guest
Posts: n/a
 
      04-19-2011
On Apr 19, 12:42*pm, "Paul" <(E-Mail Removed)> wrote:
> Standard does no such thing. not. You made a leap from "array of
> dimension n, when it appears in an expression, is __converted__ to a
> pointer to an array of the dimension n-1. The opposite is not true,
> and standard does not say that. You are misinterpreting that passage.
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> Yes so if we convert an array to a pointer , the resulting pointer is a
> pointer to an (n-1) dim array.
> So now we have a pointer to the array, the pointer-type just happens to be
> type pointer to (n-1) dim array.


The pointer-type says what the pointer __is__. When dereferenced, it
will give you a reference to the first element of the array. When
incremented, it will give you next element of the array. When indexed,
it will index inside the array. It __never__ points to the array, only
to it's elements, first or otherwise.

It walks like a duck, it quacks like a duck, it __is__ a duck.

Now go huff and puff some more, I see you like that. And it amuses me,
too.

Goran.
 
Reply With Quote
 
Paul
Guest
Posts: n/a
 
      04-20-2011

"Goran" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
On Apr 19, 12:42 pm, "Paul" <(E-Mail Removed)> wrote:
> Standard does no such thing. not. You made a leap from "array of
> dimension n, when it appears in an expression, is __converted__ to a
> pointer to an array of the dimension n-1. The opposite is not true,
> and standard does not say that. You are misinterpreting that passage.
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> Yes so if we convert an array to a pointer , the resulting pointer is a
> pointer to an (n-1) dim array.
> So now we have a pointer to the array, the pointer-type just happens to be
> type pointer to (n-1) dim array.


The pointer-type says what the pointer __is__. When dereferenced, it
will give you a reference to the first element of the array. When
incremented, it will give you next element of the array. When indexed,
it will index inside the array. It __never__ points to the array, only
to it's elements, first or otherwise.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
From the C standard this is the definition of a ponter-type:
"A pointer type describes an object whose value provides a reference to an
entity of the referenced type."

This is only part of the definiton, the whole definition is publicly
available in the C standard, and I am not trying to hide anything I am
quoting the part I think is releveant.

The value of a pointer provides a reference to an entity, of the referenced
type.

For a pointer to reference and array of T's, it must be type T*. T is the
referenced type not T[Size].

A pointer to T[Size], such as T (*p)[Size], does not reference the array, it
referneces an array-type, which is a different object than the array. It is,
under the hood, another pointer object, it does not reference THE ARRAY of
T's, it references a different array-type object.



 
Reply With Quote
 
Goran
Guest
Posts: n/a
 
      04-21-2011
On Apr 20, 5:29*pm, "Paul" <(E-Mail Removed)> wrote:
> "Goran" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
> On Apr 19, 12:42 pm, "Paul" <(E-Mail Removed)> wrote:
>
> > Standard does no such thing. not. You made a leap from "array of
> > dimension n, when it appears in an expression, is __converted__ to a
> > pointer to an array of the dimension n-1. The opposite is not true,
> > and standard does not say that. You are misinterpreting that passage.
> > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

>
> > Yes so if we convert an array to a pointer , the resulting pointer is a
> > pointer to an (n-1) dim array.
> > So now we have a pointer to the array, the pointer-type just happens tobe
> > type pointer to (n-1) dim array.

>
> The pointer-type says what the pointer __is__. When dereferenced, it
> will give you a reference to the first element of the array. When
> incremented, it will give you next element of the array. When indexed,
> it will index inside the array. It __never__ points to the array, only
> to it's elements, first or otherwise.
>
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> From the C standard this is the definition of a ponter-type:
> "A pointer type describes an object whose value provides a reference to an
> entity of the referenced type."
>
> This is only part of the definiton, the whole definition is publicly
> available in the C standard, and I am not trying to hide anything I am
> quoting the part I think is releveant.
>
> The value of a pointer provides a reference to an entity, of the referenced
> type.
>
> For a pointer to reference and array of T's, it must be type T*. T is the
> referenced type not T[Size].
>
> A pointer to T[Size], such as T (*p)[Size], does not reference the array,it
> referneces an array-type, which is a different object than the array. It is,
> under the hood, another pointer object, it does not reference THE ARRAY of
> T's, it references a different array-type object.


You have no idea what you are talking about. Specifically, "A pointer
to T[Size], such as T (*p)[Size], does not reference the array, it
referneces an array-type, which is a different object than the array"
is simply nonsense. Among other things, it is nonsense because you are
mixing "array-type" and "object" (the latter being an instance of a
type).

You are also making stuff up as you go along. Standard __nowhere__
says that pointer references anything. It does say that pointer points
to something.

Therefore, your explanation is worthless.

Goran.
 
Reply With Quote
 
Paul
Guest
Posts: n/a
 
      04-21-2011

"Goran" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
On Apr 20, 5:29 pm, "Paul" <(E-Mail Removed)> wrote:
> "Goran" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
> On Apr 19, 12:42 pm, "Paul" <(E-Mail Removed)> wrote:
>
> > Standard does no such thing. not. You made a leap from "array of
> > dimension n, when it appears in an expression, is __converted__ to a
> > pointer to an array of the dimension n-1. The opposite is not true,
> > and standard does not say that. You are misinterpreting that passage.
> > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

>
> > Yes so if we convert an array to a pointer , the resulting pointer is a
> > pointer to an (n-1) dim array.
> > So now we have a pointer to the array, the pointer-type just happens to
> > be
> > type pointer to (n-1) dim array.

>
> The pointer-type says what the pointer __is__. When dereferenced, it
> will give you a reference to the first element of the array. When
> incremented, it will give you next element of the array. When indexed,
> it will index inside the array. It __never__ points to the array, only
> to it's elements, first or otherwise.
>
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> From the C standard this is the definition of a ponter-type:
> "A pointer type describes an object whose value provides a reference to an
> entity of the referenced type."
>
> This is only part of the definiton, the whole definition is publicly
> available in the C standard, and I am not trying to hide anything I am
> quoting the part I think is releveant.
>
> The value of a pointer provides a reference to an entity, of the
> referenced
> type.
>
> For a pointer to reference and array of T's, it must be type T*. T is the
> referenced type not T[Size].
>
> A pointer to T[Size], such as T (*p)[Size], does not reference the array,
> it
> referneces an array-type, which is a different object than the array. It
> is,
> under the hood, another pointer object, it does not reference THE ARRAY of
> T's, it references a different array-type object.


You have no idea what you are talking about. Specifically, "A pointer
to T[Size], such as T (*p)[Size], does not reference the array, it
referneces an array-type, which is a different object than the array"
is simply nonsense. Among other things, it is nonsense because you are
mixing "array-type" and "object" (the latter being an instance of a
type).
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx
An array-type object is not an instance of a type. Its a fancy pointer with
typeinfo.
Apparently you have no idea, for example the object "arr" is an instance of
what type ?
int arr[10];

This is an array-type object. The instances here are the instances of
integer objects that make up the array.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx

You are also making stuff up as you go along. Standard __nowhere__
says that pointer references anything. It does say that pointer points
to something.

Therefore, your explanation is worthless.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx
Its in the definition that C++ inherits from the C standard.

"Apointer type may be derived from a function type, an object type, or an
incomplete
type, called the referenced type. A pointer type describes an object whose
value
provides a reference to an entity of the referenced type. A pointer type
derived from
the referenced type T is sometimes called ''pointer to T''. The construction
of a
pointer type from a referenced type is called ''pointer type derivation''."



 
Reply With Quote
 
Goran
Guest
Posts: n/a
 
      04-22-2011
On Apr 21, 7:24*pm, "Paul" <(E-Mail Removed)> wrote:
> "Goran" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
> On Apr 20, 5:29 pm, "Paul" <(E-Mail Removed)> wrote:
>
>
>
> > "Goran" <(E-Mail Removed)> wrote in message

>
> >news:(E-Mail Removed)....
> > On Apr 19, 12:42 pm, "Paul" <(E-Mail Removed)> wrote:

>
> > > Standard does no such thing. not. You made a leap from "array of
> > > dimension n, when it appears in an expression, is __converted__ to a
> > > pointer to an array of the dimension n-1. The opposite is not true,
> > > and standard does not say that. You are misinterpreting that passage.
> > > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

>
> > > Yes so if we convert an array to a pointer , the resulting pointer isa
> > > pointer to an (n-1) dim array.
> > > So now we have a pointer to the array, the pointer-type just happens to
> > > be
> > > type pointer to (n-1) dim array.

>
> > The pointer-type says what the pointer __is__. When dereferenced, it
> > will give you a reference to the first element of the array. When
> > incremented, it will give you next element of the array. When indexed,
> > it will index inside the array. It __never__ points to the array, only
> > to it's elements, first or otherwise.

>
> > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > From the C standard this is the definition of a ponter-type:
> > "A pointer type describes an object whose value provides a reference toan
> > entity of the referenced type."

>
> > This is only part of the definiton, the whole definition is publicly
> > available in the C standard, and I am not trying to hide anything I am
> > quoting the part I think is releveant.

>
> > The value of a pointer provides a reference to an entity, of the
> > referenced
> > type.

>
> > For a pointer to reference and array of T's, it must be type T*. T is the
> > referenced type not T[Size].

>
> > A pointer to T[Size], such as T (*p)[Size], does not reference the array,
> > it
> > referneces an array-type, which is a different object than the array. It
> > is,
> > under the hood, another pointer object, it does not reference THE ARRAYof
> > T's, it references a different array-type object.

>
> You have no idea what you are talking about. Specifically, "A pointer
> to T[Size], such as T (*p)[Size], does not reference the array, it
> referneces an array-type, which is a different object than the array"
> is simply nonsense. Among other things, it is nonsense because you are
> mixing "array-type" and "object" (the latter being an instance of a
> type).
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx
> An array-type object is not an instance of a type. Its a fancy pointer with
> typeinfo.
> Apparently you have no idea, for example the object "arr" is an instance of
> what type ?
> int arr[10];
>
> This is an array-type object. The instances here are the instances of
> integer objects that make up the array.
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx


What you said up here is pretty correct. However, that bears no
relevance to what I quoted you about:

"A pointer to T[Size], such as T (*p)[Size], does not reference the
array, it referneces an array-type, which is a different object than
the array."

The above is still nonsense, and your subsequent post didn't explain
anything in there.

> You are also making stuff up as you go along. Standard __nowhere__
> says that pointer references anything. It does say that pointer points
> to something.
>
> Therefore, your explanation is worthless.
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx
> Its in the definition that C++ inherits from the C standard.
>
> "Apointer type may be derived from a function type, an object type, or an
> incomplete
> type, called the referenced type. A pointer type describes an object whose
> value
> provides a reference to an entity of the referenced type. A pointer type
> derived from
> the referenced type T is sometimes called ''pointer to T''. The construction
> of a
> pointer type from a referenced type is called ''pointer type derivation''.."


My words "standard never says that pointer references anything" are
correct. Your standard quote, e.g. "A pointer type derived from the
referenced type T is sometimes called ''pointer to T''" does not say,
nor mean, that pointer __references__ anything, which is what you
previous post said. Pointer __points to__ something, and this is what
standard does say. And especially in the context of C++, word
"reference" typically has another meaning.

I believe that you are arbitrarily muddying things up to support your
worthless point.

Goran.
 
Reply With Quote
 
Paul
Guest
Posts: n/a
 
      04-22-2011

"Goran" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
On Apr 21, 7:24 pm, "Paul" <(E-Mail Removed)> wrote:
> "Goran" <(E-Mail Removed)> wrote in message
> >news:(E-Mail Removed)...
> > On Apr 19, 12:42 pm, "Paul" <(E-Mail Removed)> wrote:

>
> > > Standard does no such thing. not. You made a leap from "array of
> > > dimension n, when it appears in an expression, is __converted__ to a
> > > pointer to an array of the dimension n-1. The opposite is not true,
> > > and standard does not say that. You are misinterpreting that passage.
> > > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

>
> > > Yes so if we convert an array to a pointer , the resulting pointer is
> > > a
> > > pointer to an (n-1) dim array.
> > > So now we have a pointer to the array, the pointer-type just happens
> > > to
> > > be
> > > type pointer to (n-1) dim array.

>
> > The pointer-type says what the pointer __is__. When dereferenced, it
> > will give you a reference to the first element of the array. When
> > incremented, it will give you next element of the array. When indexed,
> > it will index inside the array. It __never__ points to the array, only
> > to it's elements, first or otherwise.

>
> > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > From the C standard this is the definition of a ponter-type:
> > "A pointer type describes an object whose value provides a reference to
> > an
> > entity of the referenced type."

>
> > This is only part of the definiton, the whole definition is publicly
> > available in the C standard, and I am not trying to hide anything I am
> > quoting the part I think is releveant.

>
> > The value of a pointer provides a reference to an entity, of the
> > referenced
> > type.

>
> > For a pointer to reference and array of T's, it must be type T*. T is
> > the
> > referenced type not T[Size].

>
> > A pointer to T[Size], such as T (*p)[Size], does not reference the
> > array,
> > it
> > referneces an array-type, which is a different object than the array. It
> > is,
> > under the hood, another pointer object, it does not reference THE ARRAY
> > of
> > T's, it references a different array-type object.

>
> You have no idea what you are talking about. Specifically, "A pointer
> to T[Size], such as T (*p)[Size], does not reference the array, it
> referneces an array-type, which is a different object than the array"
> is simply nonsense. Among other things, it is nonsense because you are
> mixing "array-type" and "object" (the latter being an instance of a
> type).
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx
> An array-type object is not an instance of a type. Its a fancy pointer
> with
> typeinfo.
> Apparently you have no idea, for example the object "arr" is an instance
> of
> what type ?
> int arr[10];
>
> This is an array-type object. The instances here are the instances of
> integer objects that make up the array.
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx


What you said up here is pretty correct. However, that bears no
relevance to what I quoted you about:

"A pointer to T[Size], such as T (*p)[Size], does not reference the
array, it referneces an array-type, which is a different object than
the array."

The above is still nonsense, and your subsequent post didn't explain
anything in there.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxx
The only nonsesne is coming from you.
You are trying to argue that a pointer to an array of chars, is a pointer to
an array-type object and not a pointer to char type objects.
Which is obviously technically incorrect.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxx


> You are also making stuff up as you go along. Standard __nowhere__
> says that pointer references anything. It does say that pointer points
> to something.
>
> Therefore, your explanation is worthless.
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx
> Its in the definition that C++ inherits from the C standard.
>
> "Apointer type may be derived from a function type, an object type, or an
> incomplete
> type, called the referenced type. A pointer type describes an object whose
> value
> provides a reference to an entity of the referenced type. A pointer type
> derived from
> the referenced type T is sometimes called ''pointer to T''. The
> construction
> of a
> pointer type from a referenced type is called ''pointer type
> derivation''."


My words "standard never says that pointer references anything" are
correct. Your standard quote, e.g. "A pointer type derived from the
referenced type T is sometimes called ''pointer to T''" does not say,
nor mean, that pointer __references__ anything, which is what you
previous post said. Pointer __points to__ something, and this is what
standard does say. And especially in the context of C++, word
"reference" typically has another meaning.

I believe that you are arbitrarily muddying things up to support your
worthless point.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Its quite obviously you that are muddying things up.
You seem to speaking a big pile of **** abut what your interpretation of
"references" is.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments