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

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

From: Allen, Michael B (RSCH) <Michael_B_Allen@ml.com>
Date: Thu, 28 Mar 2002 18:53:56 -0500
Message-ID: <2D31030A810FD611973700306E0208F61998A2@ehope07.hew.us.ml.com>
To: "'Arnold, Curt'" <Curt.Arnold@hyprotech.com>, "'www-dom@w3.org'" <www-dom@w3.org>


> -----Original Message-----
> From:	Arnold, Curt [SMTP:Curt.Arnold@hyprotech.com]
> Sent:	Thursday, March 28, 2002 6:34 PM
> To:	'www-dom@w3.org'
> Subject:	Use of "unsigned" for non-enumeration values
> 
> Except when there is need for that extra bit of range, it seems undesirable
> to make integer arguments or writable attributes that are not enumerations
> "unsigned".  It doesn't matter in Java or JavaScript, since neither supports
> the concept of unsigned numbers.  It does, however, make implementations in
> other language either fail differently or incorrectly succeed, since C and
> C++ will transparently convert a negative signed number into a large
> positive number.
> 
	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.

	Mike
Received on Thursday, 28 March 2002 18:53:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:55 GMT