* cg_chas, on 12.04.2011 20:15:
* Noah Roberts, on 12.04.2011 18:37:
On 4/11/2011 7:00 PM, Alf P. Steinbach /Usenet wrote: [snip]
The second way in which a pointer can point to an array, is the answer
to question 3, namely
int a[42];
int* p2 = a; // OK, p2 is a pointer to an array (dynamically).
No.
That's silly (see below).
The p2 variable is a pointer to int because an int is what you get when you
dereference it.
Yes.
3) And a pointer of type T* be said to point to an array of T, but only
in the dynamic sense, like "right now it points to an array".
The other important part of pointers is that when the point to elements of an
array, you can perform math on them. This fact though does not change what type
you get when you dereference the pointer. To claim that a pointer points at
anything other than what you get when you dereference it flies in the face of
the concept of "pointer".
Here is one counter-example to your claim:
int x;
void* p =&x;
p cannot be derferenced. Hence in your view a claim that it points to/at x
"flies in the face of the concept of pointer".
Ok now I am starting to think that you and Paul are drinking from the same well.
Don't know about Paul, because he's in my killfile.
But in case it was not obvious, the above exemplifies a direct
self-contradiction in Noah's view.
I think that when a self-contradiction is pointed out, then about the least
reasonable response is to snip the short argument and add a personal attack.
Hence, I plonked him, also because of his earlier allegations about sexual
deviations of Johannes Schaub. And similarly, in the case of Paul, killfiled in
part because of earlier allegations about sexual deviations of Francis
Glasborrow, and in the case of Leigh I remember killfiling him for a tirade
about Pete Becker, on top of generally trollish behavior, but I may have been
wrong, judging from glimpses I've had. But at least regarding Paul and Noah,
these folks are really *real* trolls, people who just love to stir up a fight
and who write all kinds of nasty stuff about others, make no mistake about it.
Of course a void pointer is an exception. We could also cast the pointer to an
infinite number of types and expect infinitely different types of yielded
values.
He does not assert that all pointers must be dereferenceable, just that
dereferencing the int* in the former example yields an int.
No, what Noah wrote, which is quoted in context above, was
"To claim that a pointer points at anything other than what you get when you
dereference it flies in the face ofthe concept of "pointer".
If, then, he supported the claim that
p points to x
then he would be claiming that p points to something other than what you get
when you dereference it, and hence in his own view that support for the
statement "p points to x" would fly in the face of the concept of "pointer".
Hence Noah cannot reasonably be supporting the view that p points to x.
However, just about everybody else would agree that p points to x.
I am guessing that for example you, too, agree with that.
Be that as it may (about your agreement or not), Noah's view, where p cannot
point to anything, is not in line with the general consensus about the
terminology here. And so it is quite irrelevant as an argument about pointers
that point to arrays, or not. Invalid is invalid, however sweet it may sound.
[snipped irrelevant argumentantion]
Cheers & hth.,
- Alf