pointer/integer type distinction
Eric W. Biederman
ebiederm@cse.unl.edu
Sat, 13 Apr 1996 14:50:51 -0500
I answered this earlier, and rambled and messed up.
Here are some clearer answeres.
I'm having problems with how to separate pointers and integers. Some
questions:
1. Should there be completely separate operators for integers and pointers?
Yes, as far as names so they can have different different type
information associated with them. So you can tell what their
arguments are.
2. Should it be possible to add integers to pointers, etc.?
Indexing off a pointer sounds reasonable, but comparing a pointer to
an integer is a no-no. I'm looking for typesafety.
3. What should happen if someone uses an integer-only operator on a pointer?
The garbage collector should byte them. That is undefined operation.
4. What is the best way to implement this so that a minimum number of
instructions/cycles are needed to do all this?
What I am most looking for, for the garbage collector is typesafe
information, so the garbage collector can tell what is a pointer and
what is an integer. I would let it rest as undefined what happens if
they misuse the operations, and the garbage collector can bite them.
Questions 1 and 4 are closely related, since "smart" operators would be
expensive.
One possible answer to question 3 would be to implement exception handling
in the LLL. Something like the ANS Forth "THROW" might be appropriate.
For GC to work, the answer to question 2 would seem to be "very limited".
But there would need to be a fairly complete set of operators to access
data through a pointer. Limitations here should be done very carefully.
Opinions, anyone?
Mine basically go, let me figure out what type everthing is in the
garbage collector, and it should be good. I've got about 3 weeks
left of school, in which I need to write a term paper, and study,
study, and then I should be able to help.
Eric