From 3153088738016933959
X-Google-Thread: f78e5,5765784582f38606,start
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.speakeasy.net!news.speakeasy.net.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 26 Sep 2006 00:00:14 -0500
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.csse.unimelb.edu.au: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Original-To: std-c++@mailman.ucar.edu
Delivered-To: std-c++@mailman.ucar.edu
From: "abadura" <abadura@o2.pl>
Newsgroups: comp.std.c++
Subject: codecvt::length
Organization: http://groups.google.com
Message-ID: <1159225259.934455.72830@i42g2000cwa.googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Complaints-To: groups-abuse@google.com
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: i42g2000cwa.googlegroups.com; posting-host=83.27.145.131;
   posting-account=hzZgZw0AAABNlF3dcXC7kXvMu4zGMewE
X-Virus-Scanned: amavisd-new at ucar.edu
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Date: Mon, 25 Sep 2006 23:57:57 CST
Lines: 32
NNTP-Posting-Host: 65.182.171.162
X-Trace: sv3-9WsV/OUvvH+2mrXgGEL+Ngyp+mUSiE5bqjVSB9cUO8RXGDct4snVe6VB3hJPpbvLZXkbzE0KKBcACi+!S5kbhmDP2oVf00i8/HDLaSm/WoFcZTmq3hR+GfC/rxetor+qr0Yqm+djiTDEu2xuQhxbvCQ8Ll0K!8+Fe9+l6T3gcThZIMuxs7cwERh/qQ7JvKseSG40vCw==
X-Complaints-To: abuse@speakeasy.net
X-DMCA-Complaints-To: abuse@speakeasy.net
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.32
Xref: g2news2.google.com comp.std.c++:3892

   Why does codecvt::length make implicit assumptions on standard
typedefs?

   In the Standard we can find [22.2.1.5 Class template codecvt] that
codecvt::length has following declaration:

int length(stateT&, const externT* from, const externT* end, size_t
max) const;

   The result could be the value of "max". But "max" is of type
"size_t" which does not have to be int. I even suppose (but cannot find
it in the Standard right now - can any one help?) that size_t is
unsigned. In fact on one compiler I checked (MS VS.NET 2005)
size_t=unsigned int. So it is possible that length would not be able to
return the true value because it is to big to be stored in int.
   The same is true when the return value should be end-from which is
of type ptrdiff_t.
   Also if the return value is some other function of the arguments it
still could be to big for int.

   Should it have additional "ifs" for checking this case and returning
numeric_limits<int>::max()? The Standard doesn't seem (for me) to
specify this.

   Adam Badura

---
[ 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.comeaucomputing.com/csc/faq.html                      ]



