Re: New Book: The School of Niklaus Wirth

gdemont@my-deja.com
22 Nov 2000 12:09:44 -0500

          From comp.compilers

Related articles
[11 earlier articles]
Re: New Book: The School of Niklaus Wirth genew@shuswap.net (2000-11-14)
Re: New Book: The School of Niklaus Wirth gdemont@my-deja.com (2000-11-16)
Re: New Book: The School of Niklaus Wirth jerrold.leichter@smarts.com (Jerry Leichter) (2000-11-17)
Re: New Book: The School of Niklaus Wirth fjh@cs.mu.OZ.AU (2000-11-19)
Re: New Book: The School of Niklaus Wirth vbdis@aol.com (2000-11-19)
Re: New Book: The School of Niklaus Wirth jerrold.leichter@smarts.com (Jerry Leichter) (2000-11-21)
Re: New Book: The School of Niklaus Wirth gdemont@my-deja.com (2000-11-22)
Re: types and subranges, was New Book: The School of Niklaus Wirth joachim_d@gmx.de (Joachim Durchholz) (2000-11-25)
Re: types and subtypes, was New Book: The School of Niklaus Wirth vbdis@aol.com (2000-11-26)
Re: New Book: The School of Niklaus Wirth nr@labrador.eecs.harvard.edu (2000-11-30)
| List of all articles for this month |

From: gdemont@my-deja.com
Newsgroups: comp.compilers
Date: 22 Nov 2000 12:09:44 -0500
Organization: Deja.com - Before you buy.
References: 00-11-120 00-11-136
Keywords: types
Posted-Date: 22 Nov 2000 12:09:44 EST



> >A subrange is a thing, the kind of animal containing the value is
> >another.


VBDis


> IMO subranges with explicit bounds are the most portable kind of
> data types. The lower bound indicates whether the value is signed
> or unsigned, and the compiler can choose the best fitting data type
> for the requested precision.


Now you have to decide what to do with an expression like (-i)
for a "subrange" like 0..100. To convert to a larger range,
to wrap or to detect a range error ?...


There a distinction between types and subtypes, "universal integers"
or integers with a certain bitwise description is important.


> Delphi internally describes all integral data types by subranges,
> including the predefined data types.


Its predecesor (Turbo Pascal) had such a description in its System
unit. But there was a total mess due to this minimalist design. You
could (or had to) do "unsigned" 32-bit operations (shift xor etc.)
with a signed type (longint) and the automatic conversions between
internal representations added a lot of extra machine code. Add to it
that there was absolutely no code optimisation... Maybe it has been
redesigned in some version of Delphi - has it ?


_____________________________________________
Gautier -- http://members.nbci.com/gdemont/


Post a followup to this message

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