From 5481746203063860116
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fc772,8d9af67f0c48e4ef
X-Google-Attributes: gidfc772,public
X-Google-Thread: f78e5,8d9af67f0c48e4ef
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2002-04-30 09:52:08 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!crtntx1-snh1.gtei.net!denver-snf1.gtei.net!news.gtei.net!namche.sun.com!news2me.EBay.Sun.COM!engnews1.eng.sun.com!taumet!clamage
From: Barry Margolin <barmar@genuity.net>
Newsgroups: comp.std.c++,comp.lang.c++.moderated
Subject: Re: Unsignedness of size_t
Date: 29 Apr 2002 22:41:32 GMT
Organization: Genuity, Woburn, MA
Lines: 35
Approved: stephen.clamage@sun.com (comp.std.c++)
Message-ID: <RPfz8.11$Vo2.244@paloalto-snr1.gtei.net>
References: <3CC7DB8F.52E75D62@bawi.org>
NNTP-Posting-Host: taumet.eng.sun.com
X-NNTP-Posting-Host: netlab.cs.rpi.edu
X-Original-Date: Mon, 29 Apr 2002 17:57:05 GMT
X-Submission-Address: c++-submit@netlab.cs.rpi.edu
X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated
	iQBVAwUAPM3AzkHMCo9UcraBAQFvUQH/SQKbw0hvzfHFvetfq+HBmSNNkKp3TvcE
	43mwtqfski2bPAhb/+qPyR8FoYpTmLDhmWv2Zp4Lbw/beUzRbp9DLg==
	=xTOO
X-Approved-For-Group: kuehl@fmi.uni-konstanz.de comp.lang.c++.moderated
X-Scanned-By: MIMEDefang 2.3 (www dot roaringpenguin dot com slash mimedefang)
Content-Length: 1483
X-Status: $$$$
X-UID: 0000000001
Originator: clamage@taumet
Xref: archiver1.google.com comp.std.c++:10908 comp.lang.c++.moderated:42397


In article <3CC7DB8F.52E75D62@bawi.org>,
Sungbom Kim  <musiphil@bawi.org> wrote:
>I often find it somewhat "flawed" that the standard requires the data
>type representing sizes of objects to be an unsigned integral type.
>
>They are just arithmetic quantities, like 'number of people'; no one
>would recommend using unsigned numbers for those kind of quantities.

Why not?  You can't have objects with negative size, just as you can't have
a class in school with a negative number of students.  Unsigned types are
appropriate for variables that can only hold non-negative values.

Since the maximum value of an unsigned type is usually twice that of the
corresponding signed value, making size_t unsigned allows for larger
objects.  I suspect this was the main rationale for this choice, not the
modular arithmetic semantics.

-- 
Barry Margolin, barmar@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.



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




