OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: Unix/Java design issues (Was: Re: Is CDATA "structure"?)

[ Lists Home | Date Index | Thread Index ]
  • From: John Cowan <cowan@locke.ccil.org>
  • To: xml-dev@ic.ac.uk
  • Date: Tue, 20 Jul 1999 14:37:43 -0400 (EDT)

Nik O scripsit:

> I understand Java's intent re the *byte* type, and i agree that Java's use
> of Unicode is a long-overdue move to non-Anglo-centric computing.  However,
> since i've been writing rock-solid C code for almost 20 years, i've long
> observed a common programmer laziness concerning all numeric types -- namely
> the non-use of the "unsigned" qualifier for inherently unsigned numbers
> (e.g. file offsets, binary file contents).  The former example created an
> unnecessary 32KB (and later 2GB) limit to file sizes handled using the
> standard C library.  The latter example is still an issue today -- at least
> for those whose computing environment includes low-resource embedded systems
> and/or legacy byte-oriented data formats.

The trouble is that although you can squeeze out a bit with unsigned numbers,
you can get hosed very easily in other ways.  (BTW, the 15-bit limit on
file sizes was gone well before the 6th Edition of Unix.)  Furthermore,
if 31 bits isn't enough, is 32 bits really so much better?

The basic problem is code like this:

	unsigned count;
	while (--count > 0) {
		/* do something */
		}

This loop will never fail, because unsigned numbers are always greater
than or equal to zero.  Our intuitions are about mathemtical integers;
machine signed ints already have overflow problems that make them deviate
from what we expect; adding unsigned behavior (overflowing below zero
as well as at MAXINT) makes such values even less intuitive.

-- 
John Cowan                                   cowan@ccil.org
       I am a member of a civilization. --David Brin

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)






 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS