W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2002

RE: Use of "unsigned" for non-enumeration values

From: Arnold, Curt <Curt.Arnold@hyprotech.com>
Date: Thu, 28 Mar 2002 17:18:03 -0700
Message-ID: <4D62A7266F41D611B92C00E018C1C19C0DD4E9@thor.aeathtl.com>
To: "'www-dom@w3.org'" <www-dom@w3.org>
Allen, Michael B (RSCH) [mailto:Michael_B_Allen@ml.com]  wrote:
> 	Actually in C at least I believe most users would 
> prefer 'int' because it's much easier to type and on most 
> systems INT_MAX is 2GB whereas UINT_MAX is 4GB which means 
> using unsigned is only
> (maybe) useful for marking stream positions and file sizes. 
> The use of unsigned long in methods like:
> 	    void deleteData(in unsigned long offset, 
> 	                                       in unsigned long count)
> 	                                       raises(DOMException);
> 	is obviously not necessary.  On systems where int is 16 
> bits or less a dom should probably not be manipulating 
> continuous strings of 32K considering the machine probably 
> wouldn't have much more main memory than that.

Can't go back and undo the past.  However, I'd strongly encourage C++ DOM's
to also expose signed variants of methods that take unsigned args.  The
signed methods would check for negatives and throw an exception (behaving
like the Java/JavaScript implementations) and then delegate to the unsigned

Then the caller can then control whether the checking or unchecking
implementation is used by selecting to do the string math using either
signed or unsigned ints and avoid the transparent promotion to unsigned.

However, for new stuff there is no reason to continue doing the same old
Received on Thursday, 28 March 2002 19:22:15 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:09 UTC