220 38237 <09b7df78-9694-896f-dc0c-e3e5f5ac3c42@gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Andrey Semashev <andrey.semashev@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: memcpy/memset/etc overloads for volatile memory
Date: Mon, 28 May 2018 18:47:10 +0300
Lines: 31
Approved: news@gmane.org
Message-ID: <09b7df78-9694-896f-dc0c-e3e5f5ac3c42@gmail.com>
References: <CAFdMc-0NAvWrkwzpgEKq4DQj=0vL_0F2s17XyR9MSUNJk5R0sw@mail.gmail.com>
 <420b274b-fc4b-413e-8ce9-b78131c782f7@isocpp.org> <5B0BFB66.7080501@gmx.net>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"; format=flowed
X-Trace: blaine.gmane.org 1527522307 16176 195.159.176.226 (28 May 2018 15:45:07 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 28 May 2018 15:45:07 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.8.0
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCXY5TXHWYJRBAOJWDMAKGQEAT3W2FQ@isocpp.org Mon May 28 17:45:02 2018
Return-path: <std-proposals+bncBCXY5TXHWYJRBAOJWDMAKGQEAT3W2FQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wr0-f198.google.com ([209.85.128.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCXY5TXHWYJRBAOJWDMAKGQEAT3W2FQ@isocpp.org>)
	id 1fNKKU-00048Q-U1
	for gclcip-std-proposals@m.gmane.org; Mon, 28 May 2018 17:45:02 +0200
Original-Received: by mail-wr0-f198.google.com with SMTP id j8-v6sf9982013wrh.18
        for <gclcip-std-proposals@m.gmane.org>; Mon, 28 May 2018 08:47:14 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1527522434; cv=pass;
        d=google.com; s=arc-20160816;
        b=ZWBDVFCG1RZ6cjLsL4DAOO++xyYgAnM693PHkWrx1JSPIdH9wJtV1YPTAFkVHHu3bp
         4TBbn1xBkzW6MyRCEfBIZOvjV7Cvq4xNO0lsbDCHPNwvtN+1FgEsm76S/z/cYt+F2Cel
         buYsoJtIrKPSVhICHEq2QrWc1bEIS+4Tivsi1yzNY/EgiZ6R2zXJl6aCoD3sDTKmMsKa
         FRAwN3kyBjstKZuydVKGTsEjSr+5BvYVdf6pwqCqi3FFFizlt4xCOBqEgenuRzTvlKhK
         wRY5mwJJ74tFlOZQbJcBKpAxrVoziPkaw8VVIeCIbthV9lrvWvoff0ZYLDhzo7JyX/YN
         JQ4A==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:content-language
         :in-reply-to:mime-version:user-agent:date:message-id:from:references
         :to:subject:arc-authentication-results:arc-message-signature
         :dkim-signature:arc-authentication-results;
        bh=dAMCO2G5OPQ8tBDmYcaW896MG1xmxeM065NjxM9L70Q=;
        b=czms0niVM2YsawCTR+scQKP/vWSMuQzOV4o/qRDxk6qXiMxt9QXhDvTwEx55/7y6IO
         W8K4ZadJI5c6Q35bU/wirBnF2zKFBJYovvHh/L6iZmNyjfajiCqrgAG3wZ/EM2ofQk4U
         MAYdm9DRBUoKniymVnovo/mxklZlElq1VYgaDlGi0Un/a1Qbcc06kLY7w39GlHmmmaLU
         nU0fvBO6zE5lINF7WUPYw8MOYbHiVmO308kENAqnJoucWEcZrkvqEIiR4OH5b2PaEjAA
         pJYzgYnIe7l8EKt3039tuM0rkwrRYCiNQ6pL/jKgZIDdzvBaqL4rDgLsIg/J5sF2Yrdh
         NM2Q==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=LlOnq+/0;
       spf=pass (google.com: domain of andrey.semashev@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andrey.semashev@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=subject:to:references:from:message-id:date:user-agent:mime-version
         :in-reply-to:content-language:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=dAMCO2G5OPQ8tBDmYcaW896MG1xmxeM065NjxM9L70Q=;
        b=WPCVy4RAjd0CPythmbNs75pyROLmSZw0T2O9cuoei4DLS8M3MkhI9miz65+gcpyVof
         XMMdeyzvvwWpCgw9KVs0sUiBQqKGXcL3e+CiEstWlhfvG/nwuwvgtp6FHkeBcnffWiPd
         RdJUskUd4K6sZZJIz8x9M9tfkpZzwcOdT/S37tHAFr22RelnE5dEa6CKcEECsfw5C96I
         ZH3cuE/dqZebtAxcSprTKgNbR0DD/M+ymKXip2BCtEaTsN0ifrA65R7aQ2Ncaan44KIZ
         7jYgTsr4u+n+csfyesCMWJb8qy0VoeW1fOjFIFRAFjIvfqLg1KI6cq0FSrZagJL72+rK
         1FTg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-language
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=dAMCO2G5OPQ8tBDmYcaW896MG1xmxeM065NjxM9L70Q=;
        b=is31JsTOJjH6348Nm7a/3uTP9SGDYSNF2DZILB4lSRmrAZb62T+uJ9ItP45eoZ4R1E
         IK2wgR03u3tGHTRekRXVd7oZSYYpz6+cLfvQIgqaHihaGebCUjq7TFc1rZE2TUvWPq+U
         67xBsf4Wuwre4lf5bh6VPxzMC4Ll3X/aTXATFxQpbfGlQSQpf0Ogk106ZCX7Yktg9TUS
         t1wuyq/lmpPERaM6qWmJb8Eby3hZQj7+am/5PYfxbWBO07ARY3bngZpvvzJwREfFgEju
         0JT5eLfKIoaAYza+0fLuJN1Ox+gXe+U3O+qOH290fv74Yhc0VNS2A50bPDcUdSCnpfaQ
         B 
X-Gm-Message-State: ALKqPwcZMJbwnGJPF01teRtg/sAWKNbaWo9CUzBKnj5kP5BUHTsW0oNU
	HrbLOSsgl0fuSi7cGqMdAZ9CtA==
X-Google-Smtp-Source: ADUXVKJSO93iZJoZQTngkBhjn5SOFr82KHVisTnEKRJvySaW6hFJeF0k+s/W1MZggrzpxYFcATPpPw==
X-Received: by 2002:a19:98d3:: with SMTP id a202-v6mr612863lfe.32.1527522434266;
        Mon, 28 May 2018 08:47:14 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a2e:7005:: with SMTP id l5-v6ls3464447ljc.14.gmail; Mon, 28
 May 2018 08:47:12 -0700 (PDT)
X-Received: by 2002:a2e:95d6:: with SMTP id y22-v6mr8693919ljh.90.1527522432783;
        Mon, 28 May 2018 08:47:12 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1527522432; cv=none;
        d=google.com; s=arc-20160816;
        b=MEBh/ad2N0xE990A0T0nyj5HOE7XEpNM6MqZNS3+iSnHlQ5WD4sZD+oei7WqzwhEkz
         b9pdel4BmuANULBt61wIqYqdRZz0hXi8eeRfuCeI+IcnWLUw/bMA6bKCeoVshI/rqT/N
         xgJjiAIrvXxb7yqQGZadZqyGVPlAJzKvLxXW/Imuqyh1TMB9YLPrmSVPDY5oWLkjj6V/
         0QkB5dX9SpNoSrWuATXwismefVsPcyJH4MZs4SXAEO3lD+ivjHj50l0cJ2HHJQ6ZBtLq
         pLNgObFr4clxiUsHNDUNIyuHjd/WnxQ7XEitr7vpqYrQ6RpCExkPWrx7ffFZwZkUYJwE
         FUXQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:content-language:in-reply-to:mime-version
         :user-agent:date:message-id:from:references:to:subject
         :dkim-signature:arc-authentication-results;
        bh=ESdtyPHsER8jK88XokNwmLFEkel2f9Q42ZOg+sF+YDU=;
        b=P3FxcNRQMfJHnobMbBkTX3PSqb6J/BTfFBwF68y1+7/Wdk5sZFljhWuAVO3BcaOsVo
         QqZF8fdGp4xJW+LXqF2pflx/bHmFe5iM5jxO+hEjdNqf7siXkOK7bkSNF5r+Fdz/+ge6
         3gyNYSQMCEMnTnVs3Kmz0SV6nKiSMR4XYoxtjAcIxPvLTzM6sNnG95KP5Y6eOBdtjQPz
         BT/tYH6eJFHYe8zbnUWF0CEqg+MQ4+i0GEazW2NPex8TP0B3aBi45+NBWrw45fwoie0+
         7ikB2zZUQiDFkHwToYGgEgUFPxA85AvSN6H9nhuzTDu4rpjlJew5mcZ5tf1qWv5NDsQK
         KOkA==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=LlOnq+/0;
       spf=pass (google.com: domain of andrey.semashev@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andrey.semashev@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65])
        by mx.google.com with SMTPS id z3-v6sor13547ljj.9.2018.05.28.08.47.12
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Mon, 28 May 2018 08:47:12 -0700 (PDT)
Received-SPF: pass (google.com: domain of andrey.semashev@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65;
X-Received: by 2002:a2e:5559:: with SMTP id j86-v6mr8778910ljb.147.1527522432315;
        Mon, 28 May 2018 08:47:12 -0700 (PDT)
Original-Received: from [192.168.1.2] (broadband-178-140-223-238.ip.moscow.rt.ru. [178.140.223.238])
        by smtp.googlemail.com with ESMTPSA id j15-v6sm6928077lfh.72.2018.05.28.08.47.11
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 28 May 2018 08:47:11 -0700 (PDT)
In-Reply-To: <5B0BFB66.7080501@gmx.net>
Content-Language: en-US
X-Original-Sender: andrey.semashev@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=LlOnq+/0;       spf=pass
 (google.com: domain of andrey.semashev@gmail.com designates 209.85.220.65 as
 permitted sender) smtp.mailfrom=andrey.semashev@gmail.com;       dmarc=pass
 (p=NONE sp=QUARANTINE 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-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://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>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:38237
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/38237>

On 05/28/18 15:51, Jens Maurer wrote:
> On 05/28/2018 01:09 AM, Niall Douglas wrote:
>> Just there this weekend I, yet again, had to write a custom memcpy()
>> implementation because the built-in one can be elided by the compiler
>> during optimisation. I'd like to stop having to write memcpy()
>> personally.
>>
>> I think your idea has two variants:
>>
>> 1. Cannot be optimised out memcpy/memset/memmove etc. I'd suggest
>> secure_memset(), secure_memcpy(), secure_memmove() and so on rather
>> than editions taking a volatile pointer.
> 
> ISO C11 has memset_s in K.3.7.4.1.

Annex K is basically dead and is considered for for removal, as I heard.

There are a few non-portable replacements, though.

http://netbsd.gw.com/cgi-bin/man-cgi?explicit_memset+3+NetBSD-current
https://manpages.debian.org/testing/manpages-dev/bzero.3.en.html

Having a portable equivalent of explicit_memset & co. in the standard 
(but not Annex K) would be really useful.

-- 
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/09b7df78-9694-896f-dc0c-e3e5f5ac3c42%40gmail.com.

.
