From 7019443540380723825
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-01 15:02:13 PST
Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!supernews.com!newsfeed.ision.net!ision!nautilus.eusc.inter.net!newsfeed.hanau.net!newsfeed01.sul.t-online.de!t-online.de!newsfeed.vmunix.org!netnews.com!xfer02.netnews.com!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: rgetov@ultraheap.com (Radoslav Getov)
Newsgroups: comp.std.c++,comp.lang.c++.moderated
Subject: Re: Unsignedness of size_t
Date: 1 May 2002 21:58:16 GMT
Organization: http://groups.google.com/
Lines: 72
Approved: stephen.clamage@sun.com (comp.std.c++)
Message-ID: <1e27bd36.0205010847.3c667d35@posting.google.com>
References: <3CC7DB8F.52E75D62@bawi.org>
 <3ccd96e9.5974430@news.ch.kpnqwest.net>
NNTP-Posting-Host: taumet.eng.sun.com
X-NNTP-Posting-Host: netlab.cs.rpi.edu
X-Original-Date: 1 May 2002 09:47:05 -0700
X-Submission-Address: c++-submit@netlab.cs.rpi.edu
X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated
	iQBVAwUAPNBc/0HMCo9UcraBAQGULgH/YVaKTpT1JFpaCPo5WZyryaEuju+sjuyq
	b84ftiiBOXZwA7N7EgYZ2An7ShzT5ncRlGmnlyPBA+wfZ7xN7N4/ew==
	=D2mn
X-Approved-For-Group: harkness@procountinc.com comp.lang.c++.moderated
X-Scanned-By: MIMEDefang 2.3 (www dot roaringpenguin dot com slash mimedefang)
Content-Length: 2697
X-Status: $$$T
X-UID: 0000000001
Originator: clamage@taumet
Xref: archiver1.google.com comp.std.c++:10964 comp.lang.c++.moderated:42478


plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1020271625 14114 127.0.0.1 (1 May 2002 16:47:05 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: 1 May 2002 16:47:05 GMT
Content-Length: 1765
ReSent-Date: Wed, 1 May 2002 09:56:57 -0700 (PDT)
ReSent-From: Steve Clamage <clamage@eng.sun.com>
ReSent-To:  <c++-submit@netlab.cs.rpi.edu>
ReSent-Subject: Re: Unsignedness of size_t
ReSent-Message-ID: <Pine.SOL.4.33.0205010956570.10978@taumet>

rhairgroveNoSpam@Pleasebigfoot.com (Bob Hairgrove) wrote in message
news:<3ccd96e9.5974430@news.ch.kpnqwest.net>...

[snip]

> I believe it has more to do with the appropriateness of the domain ...
> 
> 
> For example, would it be logical to say: "We had -3 guests at our
> house last night"; or: "We need -1.5 liters of milk".
> 
> Such quantites don't make any sense.
> 
> As to arithmetic, can you give an example where it would be wise (or
> even necessary) to mix signed and unsigned values?

IMO the main problems with unsigned are:

   1) The result of some operations (e.g. a-b) is "non-intuitive"; 
   2) Mixed (signed/unsigned) expressions are 'unsigned';
   3) A false sense of 'safety' (guaranteed non-negativeness and a wider range)

These, in combination with the fact that 'int' is traditionally "the type 
to use" in C, quite often cause troubles.

BTW can you imagine the existense of "unsigned double"? I've seen many
language extension proposals in these groups but not this one. Noone 
needs it! The (signed) double seems to be good enough. Having unsigned one 
(with 1 bit better accuracy, guaranteed non-negativeness, strange 
mixed expressions results) would cause just a confusion. The same way as 
does unsigned int, short, etc.

Long ago 1 bit (in numbers' representations range) might have been 
important; that's not the case anymore. While unsigned is here to 
stay for compatibility reasons, fhere is no need to use it in the 
contemporary programs. I think it's very unfortunate that
size_t happens to be unsigned and that STL (a relativelly contemporary 
creation) uses size_t and not int almost exclusivelly. 

You can also find some good advice about using 'unsigned' in Lakos's book. 


Radoslav Getov
www.ultraheap.com


[snip]



      [ 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                       ]




