From 1988143095130126321
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,8d9af67f0c48e4ef
X-Google-Attributes: gidf78e5,public
X-Google-Thread: fc772,8d9af67f0c48e4ef
X-Google-Attributes: gidfc772,public
X-Google-ArrivalTime: 2002-05-03 07:42:08 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!cpk-news-hub1.bbnplanet.com!denver-snf1.gtei.net!news.gtei.net!namche.sun.com!sunnews1.Eng.Sun.COM!engnews1.eng.sun.com!taumet!clamage
From: Francis Glassborow <francis.glassborow@ntlworld.com>
Newsgroups: comp.std.c++,comp.lang.c++.moderated
Subject: Re: Unsignedness of size_t
Date: 3 May 2002 14:37:50 GMT
Organization: Southfield Microcomputer SS
Lines: 53
Approved: stephen.clamage@sun.com (comp.std.c++)
Message-ID: <kIroLmF3$S08EwtD@robinton.demon.co.uk>
References: <3CC7DB8F.52E75D62@bawi.org>
 <1020129034.890475@cswreg.cos.agilent.com>
Reply-To: Francis Glassborow <francisG@robinton.demon.co.uk>
NNTP-Posting-Host: taumet.eng.sun.com
X-NNTP-Posting-Host: netlab.cs.rpi.edu
X-Original-Date: Thu, 2 May 2002 13:24:23 +0100
X-Submission-Address: c++-submit@netlab.cs.rpi.edu
X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated
	iQBVAwUAPNG4DEHMCo9UcraBAQHfkAIAnGW+QgTxLyNUW2B36jrsTiUoagn339/A
	GKErywf0PseK7Ma4a7qWuz6vBBoOzqiEl4tvLxziLdkkhGZ0zgi0zg==
	=7NUq
X-Approved-For-Group: jep@[151.161.11.6] comp.lang.c++.moderated
X-Scanned-By: MIMEDefang 2.3 (www dot roaringpenguin dot com slash mimedefang)
Content-Length: 2326
X-Status: $$$T
X-UID: 0000000001
Originator: clamage@taumet
Xref: archiver1.google.com comp.std.c++:11007 comp.lang.c++.moderated:42589


In article <1020129034.890475@cswreg.cos.agilent.com>, Geoff Field 
<geofffield@hotmail.com> writes
>> They are just arithmetic quantities, like 'number of people'; no one
>> would recommend using unsigned numbers for those kind of quantities.
>
>Why not?  Can one have *negative* numbers of people, or negative sizes?
>To my mind, unsigned integral types are the most natural model of a
>count of anything "real" - be it people, bytes or bits.

Sure, they are fine for counting. However in a world where only unsigned 
values were used (before mathematicians invented negative numbers) 
subtracting a larger number from a smaller one 'failed', it did not 
generate a ridiculously large answer. Trying to use a negative value for 
an unsigned type should raise an exception.

>
>Apart from that, unsigned types on most platforms have an extra bit
>available for counting before going to the next size up.  This may not
>matter in the hosted world, but for us embedded folks it usually means
>adding lots of overhead to drag in another library or set of routines to
>handle the bigger data type.

But in the world of embedded coding there are many other restraints. 
Anyone who jumps into that world without doing some form of conversion 
course (if only careful study in private) will write poor code. The 
requirements of embedded coding are special and should not be imposed on 
everyone. I have no problem with unsigned integer types per se. I have a 
big problem with being forced to use them or to use casts to remove 
them.

I think size_t is wrongly specified, and I think time_t and clock_t are 
underspecified (if you use either of those in arithmetic you have the 
problem that they may be any arithmetic type.)


-- 
Francis Glassborow      ACCU
64 Southfield Rd
Oxford OX4 1PA          +44(0)1865 246490
All opinions are mine and do not represent those of any organisation



      [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
      [ about comp.lang.c++.moderated. First time posters: do this! ]

[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]




