UTF-8 problems with windows

L

Lew

Tom said:
Where in the JLS does it insist - or even vaguely affirm - that it
doesn't have pointers?

Quite the opposite - the JLS explicity states that the language has pointers,
indeed, that "reference values (often just references) are pointers" (JLS §4.3.1)
From the index:

pointers
See references

ISTM that the JLS considers the two words to be synonyms.

Say rather that that the JLS defines the two words to be synonyms. Thus,
every place the JLS says "reference" it explicitly means "pointer".
 
M

Mike Schilling

Tom said:
Where in the JLS does it insist - or even vaguely affirm - that it
doesn't have pointers?

From the index:

pointers
See references

ISTM that the JLS considers the two words to be synonyms.


I think someone already quoted this, but if not:

http://www.j2ee.me/docs/white/langenv/Simple.doc2.html

A White Paper

May 1996
James Gosling
Henry McGilton

2.2.9 No More Pointers
Most studies agree that pointers are one of the primary features that
enable programmers to inject bugs into their code. Given that
structures are gone, and arrays and strings are objects, the need for
pointers to these constructs goes away. Thus, Java has no pointer data
types. Any task that would require arrays, structures, and pointers in
C can be more easily and reliably performed by declaring objects and
arrays of objects. Instead of complex pointer manipulation on array
pointers, you access arrays by their arithmetic indices. The Java
run-time system checks all array indexing to ensure indices are within
the bounds of the array.
You no longer have dangling pointers and trashing of memory because of
incorrect pointers, because there are no pointers in Java.

(f you want to argue that a white paper by the primary inventor of the
langauge is irrelevant, feel free, but you might as well be showing
off the latest Obama Kenyan birth certificate.)
 
L

Lew

Matt said:
Sure, Java has pointers. They're simply completely different from what the
rest of computing calls pointers--addresses into memory.
http://en.wikipedia.org/wiki/Pointer_(computing)

Java pointers meet this definition.

And this one.

And they meet this one.
That's the "no true Scotsman" fallacy
http://en.wikipedia.org/wiki/No_true_Scotsman.

How does this apply?
 
L

Lew

How does this apply?

Wait, I know!

People read in Usenet that someone, I'll call him "Len", asserts that Java has
pointers. Hamish McDonald reads this article and shocked, declares that "Java
does not have pointers!" The next post cites chapter and verse from the JLS
and other sources to demonstrate that Java's "references" fit the definition
of pointers and are explicitly labeled as such in the language. Hamish says,
"Those are not true pointers!"
 
M

Mike Schilling

Lew said:
There is a distinction. The paper says there are no "pointer data
types". This does not contradict the JLS that says "references ...
are pointers". There are indeed pointers in Java, and there are
indeed no pointer data types.

Of course there are pointers, even though that white paper insists
that there are not. But the word "pointer" has been whitewashed away:
there's no language construct, system class, method, or field called
pointer, except ... NullPointerException. I'm guessing that it was
called that before pointer was declared an unconcept, and had become
too prevalent to change easily. Why else wouldn't it be called
NullReferenceException? And that's precisely the sort of anachronism
this subthread is discussing.
 
L

Lew

Matt said:
Good point. But if the JLS asserts that references are pointers and
pointers are addressess into memory, does the JLS require that references
*be* addresses into memory?

Java references are addresses into memory - they point to objects to which
they refer. They aren't exposed to the programmer as *machine* addresses, but
then Java is not a machine language.
 
M

Michael Jung

Roedy Green said:
The way I see it, whether what I say solves the O.P.'s particular
problem is secondary. I am talking to the broader audience of people
who have similar problems, and people who may later find the thread
with google.
I feel disgust at an O.P. who complains when someone posts information
he already knows or that is not relevant to his particular problem, as
if the whole point of the newsgroup were to serve him alone.
Who does he think he is, the CEO of a company I work for?

It might be that an OP has a similar blurry view and is trying to
ascertain whether you understood the problem correctly. Under the
assumption that you were trying to help him not posterity.

Michael
 
A

Arne Vajhøj

Roedy said:
For me, reading most posts is like reading a foreign language. I can
pick out a few keywords, and I guess at the general problem area, and
I hand out some standard advice.
I find it difficult to disginguish between somebody explaining
something complicated, and somebody who has no clue. I don't have the
patience for detailed analysis.

If you do not have the time/will/whatever to actually read and
understand the question, then you should not try and answer.
The way I see it, whether what I say solves the O.P.'s particular
problem is secondary. I am talking to the broader audience of people
who have similar problems, and people who may later find the thread
with google.

Those searching would attempt to find threads about their problem, so
if your answer is not relevant for the question, then your answer is
not relevant for those finding it via Google later.

Arne
 
R

Roedy Green

Java references are addresses into memory - they point to objects to which
they refer. They aren't exposed to the programmer as *machine* addresses, but
then Java is not a machine language.

In the original JVMs, references were handles, pointers to pointers.
That made it easier to shuffle objects around in RAM.
 
L

Lew

Roedy said:
In the original JVMs, references were handles, pointers to pointers.
That made it easier to shuffle objects around in RAM.

What they are in the JVM is independent of the fact that in the Java language
references function as memory addresses, at a high level. Due to the
restricted nature of references in Java - you can't assign arbitrary pointer
values such as mid-object addresses, for example - this high-level abstraction
of an address is sufficient.
 
M

Mike Schilling

Lew said:
What they are in the JVM is independent of the fact that in the Java
language references function as memory addresses, at a high level.
Due to the restricted nature of references in Java - you can't
assign
arbitrary pointer values such as mid-object addresses, for example -
this high-level abstraction of an address is sufficient.

I think I could make (address,offset) work for lots of different
address implementations, including handles. (You can do it more or
less even in existing Java with a class that holds a reference and a
java.lang.reflect.Field.) What Java does that's really important is
make references completely opaque.

Does a reference fit in an int? None of your beeswax.
What bits are in a null reference? None of your beeswax.
What's the offset of the length field in a String? None of your
beeswax.

Beautiful stuff. One of the big mistakes Java made was to tell us
that chars are 16 bits. Otherwise, a char could hold every Unicode
character and we wouldn't need surrogates.
 
Joined
Nov 2, 2009
Messages
1
Reaction score
0
Printing Files with Unicode Encoding

Hi Folks,

I have a requirement. My client has files (TXT) which contain Unicode characters which displays Chinese content (Simplified Chinese) in Browser.

When Java print is invoked, it prints as ASCII characters.

When printed from Browser, these characters appear in the printout but not through Java.

Please help.

Regards
Hari N
 

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

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,224
Latest member
BettieToom

Latest Threads

Top