Re: New Book: The School of Niklaus Wirth

fjh@cs.mu.OZ.AU (Fergus Henderson)
19 Nov 2000 20:27:50 -0500

          From comp.compilers

Related articles
[9 earlier articles]
Re: New Book: The School of Niklaus Wirth joachim_d@gmx.de (Joachim Durchholz) (2000-11-11)
Re: New Book: The School of Niklaus Wirth guerby@acm.org (Laurent Guerby) (2000-11-14)
Re: New Book: The School of Niklaus Wirth vbdis@aol.com (2000-11-14)
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, was New Book: The School of Niklaus Wirth joachim_d@gmx.de (Joachim Durchholz) (2000-11-25)
Re: types, was New Book: The School of Niklaus Wirth jerrold.leichter@smarts.com (Jerry Leichter) (2000-11-30)
Re: New Book: The School of Niklaus Wirth nr@labrador.eecs.harvard.edu (2000-11-30)
[1 later articles]
| List of all articles for this month |
From: fjh@cs.mu.OZ.AU (Fergus Henderson)
Newsgroups: comp.compilers
Date: 19 Nov 2000 20:27:50 -0500
Organization: Computer Science, University of Melbourne
References: 00-11-046 00-11-082 00-11-120 00-11-122
Keywords: modula, Pascal, types
Posted-Date: 19 Nov 2000 20:27:50 EST

Jerry Leichter <jerrold.leichter@smarts.com> writes:


>There are two reasons for wanting an unsigned type:
>
> - To extend the range of small integers. This was very
> important in the days of 16-bit ints, and is almost
> certainly why unsigned ints were originally added
> to C. With 32 and now 64 bit ints the standard
> these days, this is rarely of any significance.
>
> - To implement "modulo arithmetic". Unsigned ints typically
> (and, by standard in C/C++) the mathematical properties
> of arithmetic mod 2^k. There are times when this is
> useful.


The trouble with just using a subtype for unsigned arithmetic is that
you lose one bit. Many of the most important uses of modulo
arithmetic are for the case where `k' is the word size. If your
language only provides 32-bit signed ints and subtypes thereof, and
you need 32-bit unsigned ints, then you're out of luck.


--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
                                                                        | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.


Post a followup to this message

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