Re: Generating Java Bytecode

Antoine Leca <>
1 Dec 1996 23:09:37 -0500

          From comp.compilers

Related articles
[19 earlier articles]
Re: Generating Java Bytecode (1996-11-26)
Re: Generating Java Bytecode (1996-11-26)
Re: Generating Java Bytecode (Nor Jaidi) (1996-11-26)
Re: Generating Java Bytecode (1996-12-01)
Re: Generating Java Bytecode (1996-12-01)
Re: Generating Java Bytecode (Jeremy Greene) (1996-12-01)
Re: Generating Java Bytecode (Antoine Leca) (1996-12-01)
Re: Generating Java Bytecode (Russell Bornsch++) (1996-12-03)
Re: Generating Java Bytecode (1996-12-07)
| List of all articles for this month |

From: Antoine Leca <>
Newsgroups: comp.compilers
Date: 1 Dec 1996 23:09:37 -0500
Organization: RENAULT
References: 96-11-108 96-11-125 96-11-132
Keywords: C, Java, comment

Joe Hummel wrote:
: Bill Purvis <> wrote:
: >The Java VM does support the basic things you need for C's pointer
: >rules - it's the Java Compiler that excludes them.
: Actually, I think it's the JVM that excludes general pointers...
: But we have to be careful when we say "pointer". Ada has pointers,
: and working Ada-->bytecode compilers seem to exist. But I think the
: problem is in supporting general pointers, i.e. pointer arithmetic and
: pointers to any old location in RAM:
: void *p;
: p = (void *) 0x0080001F; /* some memory location */
: *((int *) p) = 10; /* let's store 10 there */
: p++;

I'm no C legalist, but from what I understand about C "undefined
behavior", there is a perfect example of it (BTW, this concept
is very near to the concept of erroneous in Ada83).

And a given C compiler is able to do whatever it want with undefined
behavior, including rejecting the program at compile-time. Since you
will need to rewrite in part the compiler, it seems to me that this
would be a good idea in this case.

OTOH, if you really need such a program, then JavaVM and universality
and "protection" don't seem good features to me...


[I believe that there are quite legal C programs that use pointer conversions
that are impossible in Java. Consider any call to malloc() which returns a
char * pointer that is invariably whomped into some other kind of pointer.
Yes, we could special-case malloc(), but you can equally well write your own
storage allocator which would have the same pointer behavior. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.