Size of enumerations/subranges in Modula-2 
Author Message
 Size of enumerations/subranges in Modula-2

We have written a Modula-2 compiler which produces code for the NS32000
family of CPUs.  One problematic implementation issue is that of the size
of enumeration types and subrange types.

The two possibilities are:
  1. An enumeration/subrange occupies the least possible amount of bytes (the
     NS32000 are byte addressable machines).
  2. An enumeration/subrange always occupies four bytes (a double-word).  This
     is the "natural" size on the NS32000.

The issue is the usual "speed vs. space" tradeoff.  The first possibility of
course saves space, but is slower whenever doing mixed sized calculations
or array indexing, because of the conversions that must be done.

Any opinions about this issue?  In particular, I am interested in the following
two questions:
  1. How do Modula-2 compilers you know implement enumerated types and
     subranges?
  2. How would you like to see them implemented?

I'll summarize any interesting email I receive on the subject.

Thanks,
--
--- Rick Pelleg
National Semiconductor (Israel)
6 Maskit st. P.O.B. 3007, Herzlia 46104, Israel  Tel. (972)52-522264

--

Plausible paths are { ihnp4 | decvax | cbosgd | harvard | yale | bbn}!ima
Please send responses to the originator of the message -- I cannot forward
mail accidentally sent back to compilers.  Meta-mail to ima!compilers-request



Sun, 17 Jan 1993 10:09:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Size of enumerations/subranges in Modula-2

2. an algorithm for finding subranges

3. Contracts and subranges (was: Why yet another...)

4. Subranges and doubledots

5. Follow up on enumerations

6. Eiffel enumerations

7. Reading ActiveX Control Enumerations

8. Fanaticism [was Re: Enumerations and Arrays Unnecessary!???]

9. Enumerations

10. enumerations

11. Enumerations - slow down a minute!

12. Enumerations in Eiffel

 

 
Powered by phpBB® Forum Software