Re: pointers
Logan Shaw <lshaw-usenet@austin.rr.com> writes:
For example, does this C code contain any pointer arithmetic?
char* p = 0;
*p = 65;
This is not valid C code.
?Among the invalid values for dereferencing a pointer by
the unary * operator are a null pointer, [...]?
ISO/IEC 9899:1999 (E)
In C, a pointer used shall always refer to an object (just as
in Java):
?The behavior is undefined in the following circumstances:
[...]
An object is referred to outside of its lifetime
The value of a pointer to an object whose lifetime has
ended is used
[...]
An lvalue does not designate an object when evaluated?
(The null pointer does never refer to an object.)
?[...]
The operand of the unary * operator has an invalid value?
ISO/IEC 9899:1999 (E)
When you go beyond the limits of the language, you can do this
in the Java world as well (via JNI).
~~
The meaning of ?object? in C is different from the meaning of
?object? in Java.
When someone uses ?object? in this newsgroup, he uses it in
the sense of the Java Language Specification, Third Edition,
not in the sense of ISO/IEC 9899:1999 (E).
For the same reason, for a Java programmer, it is not that
relevant, what ?pointer? means in ISO/IEC 9899:1999 (E).
Insofar, you were right, when you wrote:
Well, it's a bit off-topic
But we know that the Java Language Specification, Third
Edition calls ?reference values? ?pointers?. This wording does
matter for a Java programmer, while ISO/IEC 9899:1999 (E) does
not matter for a Java programmer.