delete[] p or delete[] *p

P

Paul

A pointer type, pointer to T *is* also a pointer to a to an array of T.
I
don't need to prove it, its a fact of the language.

1.

int i;
int* pi = &i;

What array are we talking about here? In other words, if pi __is__ a
pointer to an array of T, then why is the above possible and correct,
even? Because C type system is broken or because your claim is broken?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The only thing broken is your brain. Obviously the above pointer doesn't
point to an array but the same type of pointer below points o an array:
int* p_to_array = new int[5];
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

No, it points to the first element of array allocated by new int[5].
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Bollocks you idiot , it points to both the first element *and* the array.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


But OK, I see what is your problem: you don't understand the
difference between __is__ and __points to__. That's what's confusing
you. No biggie, I can explain that to you. Consider:

class A {};
class B : public A {};

A a;
B b;
A* p=&a; // p __is__ a pointer to A and it points to an A.
p = &b; // p __is__ a pointer to A, but it points to a B.

The above is an example of a pointer that __is__ one thing (a pointer
to an A), but can __point to__ two different types. Types related, but
different nonetheless. See, there's a difference between __is__ and
__points to__? Relevant one at that, too.

Consider also:

TYPE* p;
int i;
int a[2];
int* p1=i;
int* p2=a;

Now... Expression (*p) is of type T&. Expression (p->) is also of type
T&. That much is clear. Same for p1.

But what about p2? Following your claim and basic logic, it's int[2]&,
which is, of course, utter nonsense.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
What a load of bollocks.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
P

Paul

Leigh Johnston said:
A pointer type, pointer to T *is* also a pointer to a to an array of
T. > I
don't need to prove it, its a fact of the language.

1.

int i;
int* pi = &i;

What array are we talking about here? In other words, if pi __is__ a
pointer to an array of T, then why is the above possible and correct,
even? Because C type system is broken or because your claim is broken?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The only thing broken is your brain. Obviously the above pointer doesn't
point to an array but the same type of pointer below points o an array:
int* p_to_array = new int[5];
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

No, it points to the first element of array allocated by new int[5].
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Bollocks you idiot , it points to both the first element *and* the array.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Only a pointer to an array can point to an array; p_to_array is
erroneously named as it points to an int not an array.
The only thing erroneous is your statement that p doesn't point to an array.

void* p_to_leighs_head = (void*)zero_sized_array_of_leighs_brain_cells;
 
G

Goran

"Goran" <[email protected]> wrote in message
int i;
int* pi = &i;
What array are we talking about here? In other words, if pi __is__ a
pointer to an array of T, then why is the above possible and correct,
even? Because C type system is broken or because your claim is broken?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The only thing broken is your brain. Obviously the above pointer doesn't
point to an array but the same type of pointer below points o an array:
int* p_to_array = new int[5];
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

No, it points to the first element of array allocated by new int[5].
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Bollocks you idiot , it points to both the first element *and* the array.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Consider this:

int aa[2][2]; int* p=aa[0];

So you say that p points to the array. That's aa[0]. If p points to
aa[0], then ++p must point to aa[1]. That's what incrementing a
pointer does.

Obviously, this is not true. ++p points to a[0][1].

In other words, your claim, that p points to an array, is false.
Because if it were true, simple things like pointer arithmetic
wouldn't work.

Goran.
 
I

Ian Collins

You are correct of course, but I made this exact point in more than one of
Paul's threads. It is also true that using logic on Paul doesn't work either
because he is not here to learn, nor does he listen to any post that uses simple
logic to make valid points. Surely his next reply will be to either call you an
idiot or go on about something else while ignoring the proof regarding pointer
arithmetic.

And he still won't have worked out how to configure is new client.

It really is time to stop trying to reason with this bloke.
 
P

Paul

Goran said:
int i;
int* pi = &i;
What array are we talking about here? In other words, if pi __is__ a
pointer to an array of T, then why is the above possible and correct,
even? Because C type system is broken or because your claim is broken?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The only thing broken is your brain. Obviously the above pointer doesn't
point to an array but the same type of pointer below points o an array:
int* p_to_array = new int[5];
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

No, it points to the first element of array allocated by new int[5].
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Bollocks you idiot , it points to both the first element *and* the array.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Consider this:

int aa[2][2]; int* p=aa[0];

So you say that p points to the array. That's aa[0]. If p points to
aa[0], then ++p must point to aa[1]. That's what incrementing a
pointer does.

Obviously, this is not true. ++p points to a[0][1].
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Yes p points to an array. Just because pointer arithmetic confuses you,
doesn't mean p doesn't point to an array.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

In other words, your claim, that p points to an array, is false.
Because if it were true, simple things like pointer arithmetic
wouldn't work.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I didn't claim p pointed to anything because I haven't replied to it until
now. :-S
Can you be an any bigger arsehole that you are now?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 
J

Joshua Maurice

You are correct of course, but I made this exact point in more than one of
Paul's threads.  It is also true that using logic on Paul doesn't work either
because he is not here to learn, nor does he listen to any post that usessimple
logic to make valid points. Surely his next reply will be to either call you an
idiot or go on about something else while ignoring the proof regarding pointer
arithmetic.

Unfortunately, it's not just a matter of "logic". If it was a matter
of proving something wrong with a deductive argument, then this would
not persist so long. The entire discussion is over terminology. Given
sufficient time, and some prodding, Paul could probably conclude the
same as the rest of us as to which programs are UB and which have
defined results, and what are those results (assuming he's not a
troll). Paul just adamantly chooses to use our terminology. He makes
arguments with his own unique set of words and definitions, and he
argues that his definitions are the "right" ones, which makes useful
discussion near impossible. As a separate point, one could prove that
he's wrong on a separate but related point about which set of words
are in common usage, but it appears that he's so steeped in his
certainty that he is correct that he will not listen (or he's a
troll).

I merely mean to emphasize that the problem is over which definitions
of words should we use, which usually makes for the most useless
discussions.
 
G

Goran

Goran said:
A pointer type, pointer to T *is* also a pointer to a to an array of
T.
I
don't need to prove it, its a fact of the language.
1.
int i;
int* pi = &i;
What array are we talking about here? In other words, if pi __is__ a
pointer to an array of T, then why is the above possible and correct,
even? Because C type system is broken or because your claim is broken?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The only thing broken is your brain. Obviously the above pointer doesn't
point to an array but the same type of pointer below points o an array:
int* p_to_array = new int[5];
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
No, it points to the first element of array allocated by new int[5].
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Bollocks you idiot , it points to both the first element *and* the array.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Consider this:

int aa[2][2]; int* p=aa[0];

So you say that p points to the array. That's aa[0]. If p points to
aa[0], then ++p must point to aa[1]. That's what incrementing a
pointer does.

Obviously, this is not true. ++p points to a[0][1].
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Yes p points to an array. Just because pointer arithmetic confuses you,
doesn't mean p doesn't point to an array.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

OK, say that I am confused. You say that P points to X. I say, fine,
when I increment it, it must point to next X (this is a __very__
simple truth of the language). And yet, incremented, P __does not__
point to X.

So either P does not point to X, either incrementing it does not work.
Which is true? Show the flaw in, my logic, or in yours. Or show logic
that reconciles the two.

Claims like "Just because pointer arithmetic confuses you, doesn't
mean p doesn't point to an array" is neither logic nor explanation.
It's an assertion that means nothing if not based in something
tangible. It's like a kid saying in a school playground: "Martians
exist, my dad saw them".

Goran.
 
P

Paul

Goran said:
A pointer type, pointer to T *is* also a pointer to a to an array of
T.
I
don't need to prove it, its a fact of the language.
1.
int i;
int* pi = &i;
What array are we talking about here? In other words, if pi __is__ a
pointer to an array of T, then why is the above possible and correct,
even? Because C type system is broken or because your claim is broken?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The only thing broken is your brain. Obviously the above pointer
doesn't
point to an array but the same type of pointer below points o an
array:
int* p_to_array = new int[5];
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
No, it points to the first element of array allocated by new int[5].
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Bollocks you idiot , it points to both the first element *and* the
array.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Consider this:

int aa[2][2]; int* p=aa[0];

So you say that p points to the array. That's aa[0]. If p points to
aa[0], then ++p must point to aa[1]. That's what incrementing a
pointer does.

Obviously, this is not true. ++p points to a[0][1].
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Yes p points to an array. Just because pointer arithmetic confuses you,
doesn't mean p doesn't point to an array.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

OK, say that I am confused. You say that P points to X. I say, fine,
when I increment it, it must point to next X (this is a __very__
simple truth of the language). And yet, incremented, P __does not__
point to X.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Why would you be incrementing something if you didn't know what it pointed
to?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

So either P does not point to X, either incrementing it does not work.
Which is true? Show the flaw in, my logic, or in yours. Or show logic
that reconciles the two.

Claims like "Just because pointer arithmetic confuses you, doesn't
mean p doesn't point to an array" is neither logic nor explanation.
It's an assertion that means nothing if not based in something
tangible. It's like a kid saying in a school playground: "Martians
exist, my dad saw them".

Goran.
 
G

Goran

"Goran" <[email protected]> wrote in message
A pointer type, pointer to T *is* also a pointer to a to an arrayof
T.
I
don't need to prove it, its a fact of the language.
1.
int i;
int* pi = &i;
What array are we talking about here? In other words, if pi __is__ a
pointer to an array of T, then why is the above possible and correct,
even? Because C type system is broken or because your claim is broken?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The only thing broken is your brain. Obviously the above pointer
doesn't
point to an array but the same type of pointer below points o an
array:
int* p_to_array = new int[5];
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
No, it points to the first element of array allocated by new int[5].
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Bollocks you idiot , it points to both the first element *and* the
array.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Consider this:
int aa[2][2]; int* p=aa[0];
So you say that p points to the array. That's aa[0]. If p points to
aa[0], then ++p must point to aa[1]. That's what incrementing a
pointer does.
Obviously, this is not true. ++p points to a[0][1].
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Yes p points to an array. Just because pointer arithmetic confuses you,
doesn't mean p doesn't point to an array.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

OK, say that I am confused. You say that P points to X. I say, fine,
when I increment it, it must point to next X (this is a __very__
simple truth of the language). And yet, incremented, P __does not__
point to X.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Why would you be incrementing something if you didn't know what it pointed
to?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I do know what it points to. Saying that I am confused is a (obviously
false) premise. Kindly explain what is wrong in my logic.

Goran.
 
P

Paul

"Goran" <[email protected]> wrote in message
A pointer type, pointer to T *is* also a pointer to a to an array
of
T.
I
don't need to prove it, its a fact of the language.
1.
int i;
int* pi = &i;
What array are we talking about here? In other words, if pi __is__ a
pointer to an array of T, then why is the above possible and
correct,
even? Because C type system is broken or because your claim is
broken?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The only thing broken is your brain. Obviously the above pointer
doesn't
point to an array but the same type of pointer below points o an
array:
int* p_to_array = new int[5];
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
No, it points to the first element of array allocated by new int[5].
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Bollocks you idiot , it points to both the first element *and* the
array.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Consider this:
int aa[2][2]; int* p=aa[0];
So you say that p points to the array. That's aa[0]. If p points to
aa[0], then ++p must point to aa[1]. That's what incrementing a
pointer does.
Obviously, this is not true. ++p points to a[0][1].
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Yes p points to an array. Just because pointer arithmetic confuses you,
doesn't mean p doesn't point to an array.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

OK, say that I am confused. You say that P points to X. I say, fine,
when I increment it, it must point to next X (this is a __very__
simple truth of the language). And yet, incremented, P __does not__
point to X.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Why would you be incrementing something if you didn't know what it pointed
to?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I do know what it points to. Saying that I am confused is a (obviously
false) premise. Kindly explain what is wrong in my logic.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
You don't know what this points to:
int* p = new int[6];

With the above p points to an array , you think it only points to a single
int. You do not have any consideration for what is pointed to , you
incorrectly think the pointer type defines what is pointed to.
 
L

Lasse Reichstein Nielsen

Paul said:
Consider this:
int aa[2][2]; int* p=aa[0];
....
With the above p points to an array , you think it only points to a
single int. You do not have any consideration for what is pointed to ,
you incorrectly think the pointer type defines what is pointed to.

Is it correct that in your opinion, in the above example,
the pointer p points to all of
1) aa[0][0] ,
2) aa[0] and
3) aa
?

/L
 
P

Paul

Lasse Reichstein Nielsen said:
Paul said:
Consider this:

int aa[2][2]; int* p=aa[0];
...
With the above p points to an array , you think it only points to a
single int. You do not have any consideration for what is pointed to ,
you incorrectly think the pointer type defines what is pointed to.

Is it correct that in your opinion, in the above example,
the pointer p points to all of
1) aa[0][0] ,
2) aa[0] and
3) aa
?
I don't care what it points to , its not my code. You tell me what do you
think it points to, in your words..
 
G

Goran

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I do know what it points to. Saying that I am confused is a (obviously
false) premise. Kindly explain what is wrong in my logic.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
You don't know what this points to:
int* p = new int[6];

With the above p points to an array , you think it only points to a single
int. You do not have any consideration for what is pointed to , you
incorrectly think the pointer type defines what is pointed to.

That's not the explanation, that's an assertion, and it's false.
__You__ incorrectly think that, when pointer points to the first
element of the array, it somehow points to the array as a whole. But
if you say that, pointer operations do not work as defined (as shown
by my dereferencing and incrementing examples). and yet they do. Hence
your claim is false.

Let's try the same explanation, this time from array standpoint...

typedef int (a6)[6];
a6 a[2] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
a6& ar0 = a[0];
a6& ar1 = a[1];
//a6* pa_wrong = a[0];
a6* pa = &a[0];
if (*pa != ar0) // XX
std::cout << "pointer dereferencing doesn't work";
if (*(++pa) != ar1) // YY
std::cout << "pointer incrementing doesn't work";

Here, pa __is__ a pointer to an array, and it __does__ point to an
array, array I typedef-ed as a6. When I dereference it, I get a
reference to a[0], as aptly shown by XX. When I increment it, I get a
reference to a[1], as aptly shown by YY.

If what you are saying was true, pa_wrong would compile, *pa would
give a reference to a (not a[0]), and ++pa would be UB (and it isn't,
it's legal, and it produces a reference to a[1]).

So... When you do have an array, you can easily have a pointer to that
array (pa). Your claim that a pointer to the first element of the same
array is __also__ a pointer to the array. Given that you can have
actual pointer to the array, your claim is both harmful (leads to
programming errors) and impractical.

Goran.
 
P

Paul

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I do know what it points to. Saying that I am confused is a (obviously
false) premise. Kindly explain what is wrong in my logic.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
You don't know what this points to:
int* p = new int[6];

With the above p points to an array , you think it only points to a single
int. You do not have any consideration for what is pointed to , you
incorrectly think the pointer type defines what is pointed to.

That's not the explanation, that's an assertion, and it's false.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
You have made your opinion, that a pointer-type always defines what is
pointed to, very clear.
I haven't asserted anything , you have provided this evidence. If it's false
then it's your opinion that's false, not mine
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
<snip>
 
G

Goran

I do know what it points to. Saying that I am confused is a (obviously
false) premise. Kindly explain what is wrong in my logic.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
You don't know what this points to:
int* p = new int[6];
With the above p points to an array , you think it only points to a single
int. You do not have any consideration for what is pointed to , you
incorrectly think the pointer type defines what is pointed to.

That's not the explanation, that's an assertion, and it's false.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
You have made your opinion, that a pointer-type always defines what is
pointed to, very clear.
I haven't asserted anything , you have provided this evidence. If it's false
then it's your opinion that's false, not mine

Yes you have. All you have are assertions. Not even opinions, plain
assertions. The "Martians exist, my dad saw them!" kind.

Explain how it is possible that both pointer points to an array, and
incrementing it makes it point to the next ___element in the array__.

Goran.
 
L

Lasse Reichstein Nielsen

Paul said:
Lasse Reichstein Nielsen said:
Paul said:
Consider this:

int aa[2][2]; int* p=aa[0];
...
With the above p points to an array , you think it only points to a
single int. You do not have any consideration for what is pointed to ,
you incorrectly think the pointer type defines what is pointed to.

Is it correct that in your opinion, in the above example,
the pointer p points to all of
1) aa[0][0] ,
2) aa[0] and
3) aa
?
I don't care what it points to , its not my code. You tell me what do
you think it points to, in your words..

I think it points to the int lvalue aa[0][0].
What do you think it points to?

/L
 
P

Paul

Lasse Reichstein Nielsen said:
Paul said:
Lasse Reichstein Nielsen said:
Consider this:

int aa[2][2]; int* p=aa[0];

...
With the above p points to an array , you think it only points to a
single int. You do not have any consideration for what is pointed to ,
you incorrectly think the pointer type defines what is pointed to.

Is it correct that in your opinion, in the above example,
the pointer p points to all of
1) aa[0][0] ,
2) aa[0] and
3) aa
?
I don't care what it points to , its not my code. You tell me what do
you think it points to, in your words..

I think it points to the int lvalue aa[0][0].
What do you think it points to?
I think it poiints to a section of memory.
 
P

Paul

I do know what it points to. Saying that I am confused is a (obviously
false) premise. Kindly explain what is wrong in my logic.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
You don't know what this points to:
int* p = new int[6];
With the above p points to an array , you think it only points to a
single
int. You do not have any consideration for what is pointed to , you
incorrectly think the pointer type defines what is pointed to.

That's not the explanation, that's an assertion, and it's false.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
You have made your opinion, that a pointer-type always defines what is
pointed to, very clear.
I haven't asserted anything , you have provided this evidence. If it's
false
then it's your opinion that's false, not mine

Yes you have. All you have are assertions. Not even opinions, plain
assertions. The "Martians exist, my dad saw them!" kind.

Explain how it is possible that both pointer points to an array, and
incrementing it makes it point to the next ___element in the array__.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Explain how what is possible?
I'm sorry but what you say is unclear.
 
P

Peter Remmers

Am 08.04.2011 19:09, schrieb Paul:
Lasse Reichstein Nielsen said:
Paul said:
Consider this:

int aa[2][2]; int* p=aa[0];

...
With the above p points to an array , you think it only points to a
single int. You do not have any consideration for what is pointed to ,
you incorrectly think the pointer type defines what is pointed to.

Is it correct that in your opinion, in the above example,
the pointer p points to all of
1) aa[0][0] ,
2) aa[0] and
3) aa
?

I don't care what it points to
You are so annoying. You just go on and emit your attitude crap when
challenged.
That's totally irrelevant. The question's purpose was to clarify your
position. Even though you constantly promulgate your ultimate truths and
fulminate at everyone who disputes them, you can't stand by your
position when directly asked? You make me sick.

You are unable to answer a simple question.
You evade by deflecting the question.
I think it points to the int lvalue aa[0][0].
What do you think it points to?
I think it poiints to a section of memory.

You are unable to answer a simple question.
You evade by using dummy answers.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top