From 5257393122061797880 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 12:02:08 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!denver-snf1.gtei.net!news.gtei.net!namche.sun.com!news2me.EBay.Sun.COM!sunnews1.Eng.Sun.COM!engnews1.eng.sun.com!taumet!clamage From: Jean-Marc Bourguet Newsgroups: comp.std.c++,comp.lang.c++.moderated Subject: Re: Unsignedness of size_t Date: 3 May 2002 18:52:59 GMT Organization: Guest of ProXad - France Lines: 41 Approved: stephen.clamage@sun.com (comp.std.c++) Message-ID: <3cd2a3bc$0$15599$626a54ce@news.free.fr> References: <3CC7DB8F.52E75D62@bawi.org> <86wuulbgyb.fsf@alex.gabi-soft.de> NNTP-Posting-Host: taumet.eng.sun.com X-NNTP-Posting-Host: netlab.cs.rpi.edu X-Original-Date: 03 May 2002 16:50:21 +0200 X-Submission-Address: c++-submit@netlab.cs.rpi.edu X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUAPNLPDEHMCo9UcraBAQGBkAH+PnLTCNrJX1bj2sngao1GUXQjeWlr9oVM Vx0SH8HgEfXmpw3Rotg6bujJW8vZkSboxGWHpZBLSQ6S1HgLTskxew== =RPVm 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: 1337 X-Status: $$$T X-UID: 0000000001 Originator: clamage@taumet Xref: archiver1.google.com comp.std.c++:11016 comp.lang.c++.moderated:42608 James Kanze writes: > gsakrejda@hotmail.com (Grzegorz Sakrejda) writes: [asking for carry, borrow] > The problem with these is that at the hardware level, the flag > contains the result of the last operation. More, at hardware level, there may be no carry flag. Or a set of them. > And there is no way to rigorously specify which is the last > operation preceding the call. > > On the other hand, I could very well imagine something like: > > template< typename T > // Must be basic integral type... > std::pair< T, bool > > addWithCarray( T op1, T op2, bool carry = 0 ) > { > // Some compiler magic needed here... > } > > The result is the sum of op1, op2 and the carry, with the carry in > the second element of the pair. This is possible for unsigned types, but the specification for signed one would be messy. -- Jean-Marc [ 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 ]