220 13599 <d776ee57-5a3a-484c-b815-1cef588a8313@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: ron novy <rsn10100@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: constexpr ascii character checks
Date: Thu, 2 Oct 2014 19:50:28 -0700 (PDT)
Lines: 114
Approved: news@gmane.org
Message-ID: <d776ee57-5a3a-484c-b815-1cef588a8313@isocpp.org>
References: <c9a50690-0464-43e5-8da7-e9a42e9c548a@isocpp.org> <1623033.epud7EB2qf@tjmaciei-mobl4> <06ae16b5-9e0c-493f-8284-045c29f06a2e@isocpp.org>
 <1823892.IarJFYWuo6@tjmaciei-mobl4>
 <d7b9e872-0300-4296-a581-eb8564215377@isocpp.org>
 <abce7413-ed8e-41df-a64b-b8d8f318569c@isocpp.org>
 <ae230d55-7e3a-44e5-aa12-6ef5fc72cc1b@isocpp.org>
 <cdfa7a7e-de0e-469b-bf29-fa1088fe9fc4@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_4101_913963346.1412304628711"
X-Trace: ger.gmane.org 1412304640 1659 80.91.229.3 (3 Oct 2014 02:50:40 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 3 Oct 2014 02:50:40 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDO2TPGE4QNBB5U5XCQQKGQEHXFIBQY@isocpp.org Fri Oct 03 04:50:34 2014
Return-path: <std-proposals+bncBDO2TPGE4QNBB5U5XCQQKGQEHXFIBQY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ob0-f197.google.com ([209.85.214.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDO2TPGE4QNBB5U5XCQQKGQEHXFIBQY@isocpp.org>)
	id 1XZswy-0004Ry-GT
	for gclcip-std-proposals@m.gmane.org; Fri, 03 Oct 2014 04:50:32 +0200
Original-Received: by mail-ob0-f197.google.com with SMTP id m8sf2780608obr.0
        for <gclcip-std-proposals@m.gmane.org>; Thu, 02 Oct 2014 19:50:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type;
        bh=AzJQk6NQzYe3bInT/H5HJ9TdeXZDpKHvrjon6sxR07I=;
        b=oa9MOO2FWnmclyX5xzKjW/OqkPBxUrZPJGfVxKaVTotnaF35P58TMUfGB0KQVJypsY
         GBgxXHoyVS9y2jZeoz5xp0eK0l603cyyhIqSslaa+HMgQGMZKQYRjU6EcvLGHnYrVXBC
         iHB7ijGf52oaKAoHbdqCo0U4NQC2kDkFwSFSFcrAddHcoGOO4dpYlxnLIyz9vjPp95fn
         H5RJNy6XKREDys2vGJsff1AtsCC1ZvoXKTws99dNCUdzwDJXsLvacFx9t0cDCXK69Ps2
         3DmLjiAWmV+eN1c3ZKzWTZ365zh9dUrGYACB3ok9MNADLrvWuDixeCQuhsaIRBAtTKfQ
         TvUw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=AzJQk6NQzYe3bInT/H5HJ9TdeXZDpKHvrjon6sxR07I=;
        b=PUD2r5xOuDOLQPaDiMY7FAM/Ip3VY1C0eNlR20s/ezWinUHArObA1mgSWJikApo1Rc
         o9cCWM8qKLddrYmiqAFILf0mnEDkaKSdAVXngHJREuOyYipRRND/W1DrL1zZnVXqS2a5
         u5nStA29di5xNASglx535FqKfM108cxRnS8NgL25H1KNLug9t9rSw52WQ22W4EJQlUMQ
         aTsSlOHAFls4z8X0+SOM2jmvIHSYi7ExMcSX6UtkV4HFAjUDsqI6TKiOswlPPQXLVInD
         7t/hAMx3g1zt88vDZfd//ok4Zop4ht9eIzDZZUqx/bipQor1jzxBzXnjQyx8i0UmM+es
         QStQ==
X-Gm-Message-State: ALoCoQlTlQEl7xFEPLQg2CZ7xqNSI1+htKU8vvKfrcdhN5EBK8w8zMg3mRbebHsrZrzzhuonkat5
X-Received: by 10.182.230.133 with SMTP id sy5mr3154396obc.22.1412304631602;
        Thu, 02 Oct 2014 19:50:31 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.13.4 with SMTP id d4ls739607igc.19.canary; Thu, 02 Oct 2014
 19:50:30 -0700 (PDT)
X-Received: by 10.50.132.66 with SMTP id os2mr112978igb.3.1412304630731;
        Thu, 02 Oct 2014 19:50:30 -0700 (PDT)
In-Reply-To: <cdfa7a7e-de0e-469b-bf29-fa1088fe9fc4@isocpp.org>
X-Original-Sender: rsn10100@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:13599
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/13599>

------=_Part_4101_913963346.1412304628711
Content-Type: text/plain; charset=UTF-8

I might be misunderstanding its function, but the isascii(int) function 
might give invalid results as implemented.  It returns false for a null 
character and true if any of the first 7 bits are set.  This does not match 
the description of the function where it returns true if the value passed 
is >= 0 and <= 0x7F.

// This is how you have it now in cctype.hh
constexpr bool isascii(int c) noexcept
{
    return c & 0x7F;
}

// This is how I imagine it should work.
constexpr bool isascii(int c) noexcept
{
    return (c >= 0 && c <= 0x7F);
}



-- 

--- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_4101_913963346.1412304628711
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I might be misunderstanding its function, but the isascii(=
int) function might give invalid results as implemented. &nbsp;It returns f=
alse for a null character and true if any of the first 7 bits are set. &nbs=
p;This does not match the description of the function where it returns true=
 if the value passed is &gt;=3D 0 and &lt;=3D 0x7F.<div><br></div><div><pre=
 style=3D"color: rgb(0, 0, 0);"><div class=3D"prettyprint" style=3D"border:=
 1px solid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb=
(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"=
><span style=3D"color: rgb(136, 0, 0);"><span style=3D"color: #800;" class=
=3D"styled-by-prettify">// This is how you have it now in cctype.hh</span><=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">constexpr</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">bool</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> isascii</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> c</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> noexcept<br></span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br>&nbsp; &nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">return</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> c </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&a=
mp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #066;" class=3D"styled-by-prettify">0x7F</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br><br></span><span style=3D"color: rgb(136, =
0, 0);"><span style=3D"color: #800;" class=3D"styled-by-prettify">// This i=
s how I imagine it should work.</span></span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">constexpr</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">bool</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> isascii</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">in=
t</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> c</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> noexcept<br></span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; </span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">return</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify">c </span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&gt;=3D</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-p=
rettify">0</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> c </span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;=3D</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #066;" class=3D"styled-by-prettify">0x7F</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">);</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br><br></span></div></code></div><br></pre><br></div></d=
iv>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_4101_913963346.1412304628711--

.
