220 8659 <CAGNvRgDH=X2h4K_u3zOu7gUNuQbAcNHGNh=HfCRO9qG1mmiG1w@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: =?ISO-8859-1?Q?Daniel_Kr=FCgler?= <daniel.kruegler@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: string_view::is_null()
Date: Fri, 17 Jan 2014 23:04:51 +0100
Lines: 33
Approved: news@gmane.org
Message-ID: <CAGNvRgDH=X2h4K_u3zOu7gUNuQbAcNHGNh=HfCRO9qG1mmiG1w@mail.gmail.com>
References: <8045a4d2-721d-4725-8bb7-7a91b6f53ec8@isocpp.org>
	<186E0927-C962-4E34-AED0-E7509DD1F0A0@gmail.com>
	<7aad44d8-6b4e-438a-b309-bd898b994b34@isocpp.org>
	<9C2C439F-7983-4224-B272-53CAD0E2E456@gmail.com>
	<CANh-dXnYg=1kmm1nJdSnTXmYyfBxbLTD9b+wecT+eZm5nPkf2A@mail.gmail.com>
	<CAGg_6+Pz0gQQcY_Vq6LTMFc-4iOJvVN1O3jc3gjh0J2egBTgGg@mail.gmail.com>
	<CANh-dX=Dr35_jvxadm2HWxNk6e87y8V+Dkyiw+syBfgfdTfobw@mail.gmail.com>
	<CAPOJ94O19N207rjm73tKJSc7K55kOzYxHbY9wtXquk=_uqqMsA@mail.gmail.com>
	<8E74B747-7450-41E0-8D1E-48C2D6F81535@gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: ger.gmane.org 1389996287 16392 80.91.229.3 (17 Jan 2014 22:04:47 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 17 Jan 2014 22:04:47 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCT7RVFA4QORBBGS42LAKGQE4A37JOQ@isocpp.org Fri Jan 17 23:04:54 2014
Return-path: <std-proposals+bncBCT7RVFA4QORBBGS42LAKGQE4A37JOQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-la0-f72.google.com ([209.85.215.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCT7RVFA4QORBBGS42LAKGQE4A37JOQ@isocpp.org>)
	id 1W4HX3-0002Go-EC
	for gclcip-std-proposals@m.gmane.org; Fri, 17 Jan 2014 23:04:53 +0100
Original-Received: by mail-la0-f72.google.com with SMTP id er20sf7627516lab.11
        for <gclcip-std-proposals@m.gmane.org>; Fri, 17 Jan 2014 14:04:53 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:date
         :message-id:subject:from:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=EHPEUHAnkA7hyI52UXFPmYxr+GqeAEz+Z5hvz1nJ4TM=;
        b=bgZf80WchSt7YrKWrvNrkgCxYuq48zP4LEK0nzXrnBECgpK89dLnyuXmojl/VMZ1LW
         W8WP5BH7Kvk6YYRHTqUyYzI5xVTte1a1p4WnyyzKPkGpTgH+XPE29+esA1j+rwE6Mwd5
         GpcrtvWnaUDrYJNXx3qW53Dy+5/+rjaFaiay3BBjnVJGTNRlNMKJ2h7QPlvtPMn1cZr6
         1UiHnsUIVxj5SR27Gf1yJn0GaVlQHNOrmQzshPYkZRsL7F5buSQcIFsYKTKrX6jiYC0p
         vIiQ4jZ4TeT3KeWw1jefISzZuY942QqjSzX9Z1yn7wjRIUyPR3XqOzwdW9GIlkgIyg2c
         3lrg==
X-Gm-Message-State: ALoCoQnAfh9j3bkMke4xo/qGoE1qwoVSj9AborcAWtbtV+eGDhNPh2E1Yfag1+mgwQMOzPFqmwlo
X-Received: by 10.204.69.203 with SMTP id a11mr1115073bkj.0.1389996292932;
        Fri, 17 Jan 2014 14:04:52 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.77.194 with SMTP id u2ls192261wiw.52.gmail; Fri, 17 Jan
 2014 14:04:51 -0800 (PST)
X-Received: by 10.194.2.228 with SMTP id 4mr35702wjx.95.1389996291872;
        Fri, 17 Jan 2014 14:04:51 -0800 (PST)
Original-Received: from mail-wi0-x230.google.com (mail-wi0-x230.google.com [2a00:1450:400c:c05::230])
        by mx.google.com with ESMTPS id v8si2358067wiz.76.2014.01.17.14.04.51
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Fri, 17 Jan 2014 14:04:51 -0800 (PST)
Received-SPF: pass (google.com: domain of daniel.kruegler@gmail.com designates 2a00:1450:400c:c05::230 as permitted sender) client-ip=2a00:1450:400c:c05::230;
Original-Received: by mail-wi0-f176.google.com with SMTP id hi8so1313858wib.9
        for <std-proposals@isocpp.org>; Fri, 17 Jan 2014 14:04:51 -0800 (PST)
X-Received: by 10.180.206.104 with SMTP id ln8mr386769wic.13.1389996291781;
 Fri, 17 Jan 2014 14:04:51 -0800 (PST)
Original-Received: by 10.216.5.197 with HTTP; Fri, 17 Jan 2014 14:04:51 -0800 (PST)
In-Reply-To: <8E74B747-7450-41E0-8D1E-48C2D6F81535@gmail.com>
X-Original-Sender: daniel.kruegler@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of daniel.kruegler@gmail.com designates 2a00:1450:400c:c05::230 as
 permitted sender) smtp.mail=daniel.kruegler@gmail.com;       dkim=pass
 header.i=@gmail.com;       dmarc=pass (p=NONE dis=NONE) header.from=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: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:8659
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/8659>

2014/1/17 Marshall Clow <mclow.lists@gmail.com>:
>
> Maybe I missed something earlier in the discussion, but I believe that
> std::string foo { nullptr, 0 };
>
> is a perfectly legal way of creating an empty string.

No, it is not, it undefined behaviour.

> Section 21.4.2 says only:
> basic_string(const charT* s, size_type n,
>              const Allocator& a = Allocator());
> Requires: s points to an array of at least n elements of charT.

Exactly this requirement makes above code undefined. There exists an
explicit rule in [res.on.arguments] p1 b2 for this kind of wording:

"If a function argument is described as being an array, the pointer
actually passed to the function shall
have a value such that all address computations and accesses to
objects (that would be valid if the
pointer did point to the first element of such an array) are in fact valid."

- Daniel

-- 

--- 
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/.

.
