This is wrong. You _do_ say "pointer to <value>", as well as, "pointer to <type>". While this may not be correct in the most technical sense. It's what people say, because it's easier, and to say it in the long form is redundant considering you know what one means when they say that anyway.

No you don't. I have never heard anyone EVER say "pointer to five". We have a pointer to an int, not a pointer to five. No one says "pointer to five". You could even say "pointer to myvar", but you would never say "pointer to <value myvar has>". No one does that.

Quote:

Originally Posted by Yarin

But then... if you want to get all technically correct, then really, down the same line of thinking, saying "pointer to <type>" is also wrong. It's a "pointer to <said> location in memory".

No it isn't. A pointer has to have a type associated, because the value of the memory address by itself tells us nothing (which is why you are forced to typecast void* when you want to dereference it.

Quote:

Originally Posted by Yarin

This is explained by the fact that a "null pointer" is intended to be understood as _not_ pointing to an address, in essence _not_ pointing somewhere, or pointing nowhere, all in all, not functioning as a pointer is generally expected to, ergo a "null pointer". It's for this reason we don't say it's pointing to zero.

Wrong again. A NULL pointer is specifically set to be a value to test against so you can know you have set a pointer to be "invalid". It doesn't actually have to be &0 by the way.

Quote:

Originally Posted by Yarin

While a "five pointer" (that being (void*)5), is understood to function... as a pointer, that is point to somewhere, so yeah, of course calling it a "five pointer" wouldn't make sense.

Like I said, no one says that.

Quzah.

07-29-2011

quzah

Quote:

Originally Posted by whiteflags

We all just like to argue.

Do not not not!

Quzah.

07-29-2011

grumpy

I won't debate whether people like to argue. It would sort of be like trying to convince a hurricane on whether it can or cannot change course.

What appears to be true is that some people here like like to extrapolate to points of absurdity. For example, "Since I say <X>, everyone does" versus "Since I've never need <Y>, nobody has".

I've yet to see any people (except one or two arguing for it here) describing a "pointer to value". More significantly, I've yet to encounter a programming language that requires, or even encourages, people to think that way.

Under the assumption that my observations support a more general conclusion, I will continue.

Compilers are often designed so they are quite pedantic in their interpretation of a programming language, ignorant of the intent of a programmer, and emit both verbose and cryptic error messages when they fail to understand code they are given. For this reason, it is usually a good idea for the programmer to describe things in a manner consistent with how things are described in their programming language of choice - it makes communication with the compiler easier. Similarly, when communicating with other people who use a programming language, it is also a good idea to describe things in a manner consistent with that programming language. Particularly as one cannot always be certain that another programmer speaks the same human language (English, german, russian, etc).

On that basis, I would suggest describing something as "pointer to value" rather than "pointer to type" and "pointer contains address of value" is absurd.

But that conclusion is based on several assumptions and, if members here like to argue, I am confident they will challenge both my assumptions and my conclusion. ;)

07-29-2011

quzah

Quote:

Originally Posted by grumpy

I've yet to see any people (except one or two arguing for it here) describing a "pointer to value". More significantly, I've yet to encounter a programming language that requires, or even encourages, people to think that way.

Under the assumption that my observations support a more general conclusion, I will continue.

Compilers are often designed so they are quite pedantic in their interpretation of a programming language, ignorant of the intent of a programmer, and emit both verbose and cryptic error messages when they fail to understand code they are given. For this reason, it is usually a good idea for the programmer to describe things in a manner consistent with how things are described in their programming language of choice - it makes communication with the compiler easier. Similarly, when communicating with other people who use a programming language, it is also a good idea to describe things in a manner consistent with that programming language. Particularly as one cannot always be certain that another programmer speaks the same human language (English, german, russian, etc).

On that basis, I would suggest describing something as "pointer to value" rather than "pointer to type" and "pointer contains address of value" is absurd.

I would agree, and so would this guy, as much as he doesn't want to:

Quote:

Originally Posted by Yarin

While a "five pointer" (that being (void*)5), is understood to function... as a pointer, that is point to somewhere, so yeah, of course calling it a "five pointer" wouldn't make sense.

There's a reason he had to add that cast. ;)

Quzah.

07-29-2011

Yarin

Quote:

Originally Posted by quzah

There's a reason he had to add that cast. ;)

He he, that's true. I had incorrectly assumed that we were talking about a type-less pointer, all along. For that matter, I didn't consider any consequences of type in the first place.

You say you haven't heard people say/write, "pointer to <value of type at location>". Well, I have. Yes, I agree, this is incorrect. Then again, ending sentences in prepositions is too. :D

07-29-2011

quzah

Quote:

Originally Posted by Yarin

Then again, ending sentences in prepositions is too. :D

I only use one language at a time. C it is!

Quzah.

07-29-2011

AndrewHunter

Quote:

Originally Posted by quzah

I only use one language at a time. C it is!
Quzah.

See quzah, English isn't your first language! Clearly it was C. :rolleyes::tongue: