220 29175 <CAEhD+6BXvsZ+NJgnbX3yiGQWQRzWODYz-NfG8p3U++Au90cKjA@mail.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: pragma once
Date: Fri, 28 Oct 2016 02:06:21 +0300
Lines: 31
Approved: news@gmane.org
Message-ID: <CAEhD+6BXvsZ+NJgnbX3yiGQWQRzWODYz-NfG8p3U++Au90cKjA@mail.gmail.com>
References: <CAGz9X0c=CNLVEGgJ7=GJ2W+7fsvN7h+tbiFyf5Cx3aab0Xb=rQ@mail.gmail.com>
 <ffa0cf8c-25a4-49fe-9e99-dcce452b8dd6@isocpp.org> <2c278558-0dbc-4568-9b6b-7f159c94707e@isocpp.org>
 <4610802.tOzma7na2T@tjmaciei-mobl1> <fefab967-9db3-7204-a2d0-b9984ca5e8b4@gmail.com>
 <CAGg_6+OFUqxzy-3YErVKS0-4dU2TxLrJjev9TGWKOA1v8Lnp3g@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Trace: blaine.gmane.org 1477609590 28408 195.159.176.226 (27 Oct 2016 23:06:30 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 27 Oct 2016 23:06:30 +0000 (UTC)
To: "ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCXY5TXHWYJRB3UQZLAAKGQETXXZ4GY@isocpp.org Fri Oct 28 01:06:26 2016
Return-path: <std-proposals+bncBCXY5TXHWYJRB3UQZLAAKGQETXXZ4GY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oi0-f69.google.com ([209.85.218.69])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCXY5TXHWYJRB3UQZLAAKGQETXXZ4GY@isocpp.org>)
	id 1bztkb-0006IX-2C
	for gclcip-std-proposals@m.gmane.org; Fri, 28 Oct 2016 01:06:21 +0200
Original-Received: by mail-oi0-f69.google.com with SMTP id d185sf57459599oig.1
        for <gclcip-std-proposals@m.gmane.org>; Thu, 27 Oct 2016 16:06:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :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=vhIzHgn5xqlJ3WPYsBFeLPWipy0bPdwx2WF4Z2T4FPY=;
        b=K6wqGkR0Njh2D7eZYDK7Z+PQw4E2v58YFdtiyzaP6/j+tLP9ZeWRiNcLGDZJfDVb74
         XYBQu+m77+sMAVOJqm3bNXYtrL8vPs/588v7uk+VHf50npJAMQUFKg5Q73yhOu/cPZoJ
         PeUq253XPaLXX/vwZ82c+Y+QAQDiipdqfSdQPFVRwEGu4xhgodFCDQO6sv/N+49aCFyO
         tuAkXNxZLORUADVMi1CTzBDP1V2DVy3n7UXoS9tH6M9XLupMIsmN/z+3riJiE5HiSqN2
         EEvK8LCU3V6U/faOxthcdwZUOEUYAtOet1d7F/PNw1dcL8VTCcsL9Itka/mB4wxtut6B
         eLKQ==
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:from:date
         :message-id:subject:to: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=vhIzHgn5xqlJ3WPYsBFeLPWipy0bPdwx2WF4Z2T4FPY=;
        b=BqFf3lcSkDytYsSUbnZ8KBbiz3KoBhC5HTykNUy/71agRnpyFL8+FQhxCOgali3veg
         Xo9RF3GmBUws5r6daFXgOssb/yNijGxs0gaq4c/XwWSb/XROHFmf4yOQqmShWHUmPYw6
         1/HzMwsUAB9e0n2nrHQucEuUJ6jLpv9ubdnNCmaWgS+HDKqougBYS8RjAZ2zGKfdLsaW
         sN2y8CUdEOKsN1QxNBvUXo0adS0tZKwdHNJKbrquSJLgt2+k8Zmq8NS4CsRsRsU4tlKg
         gcZhh0tY/lzLKsVHiPMeg2ssiIEKk+DkZP0E85INCLCLolXxt+bC7RCmJblf8wXi0vjv
         pFrA==
X-Gm-Message-State: ABUngve1+tKW/X975XEe4XiCzcecqVO5Zgr3pS9Robh75hIkANLTQRPYIxsGtC3RImPsKw==
X-Received: by 10.157.1.15 with SMTP id 15mr3700070otu.147.1477609583449;
        Thu, 27 Oct 2016 16:06:23 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.24.66 with SMTP id t2ls5464268ott.0.gmail; Thu, 27 Oct
 2016 16:06:22 -0700 (PDT)
X-Received: by 10.157.58.3 with SMTP id j3mr8853401otc.194.1477609582645;
        Thu, 27 Oct 2016 16:06:22 -0700 (PDT)
Original-Received: from mail-oi0-x230.google.com (mail-oi0-x230.google.com. [2607:f8b0:4003:c06::230])
        by mx.google.com with ESMTPS id s34si6354535ots.100.2016.10.27.16.06.22
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 27 Oct 2016 16:06:22 -0700 (PDT)
Received-SPF: pass (google.com: domain of andrey.semashev@gmail.com designates 2607:f8b0:4003:c06::230 as permitted sender) client-ip=2607:f8b0:4003:c06::230;
Original-Received: by mail-oi0-x230.google.com with SMTP id n202so74757888oig.3
        for <std-proposals@isocpp.org>; Thu, 27 Oct 2016 16:06:22 -0700 (PDT)
X-Received: by 10.36.80.67 with SMTP id m64mr838285itb.59.1477609582111; Thu,
 27 Oct 2016 16:06:22 -0700 (PDT)
Original-Received: by 10.79.37.81 with HTTP; Thu, 27 Oct 2016 16:06:21 -0700 (PDT)
In-Reply-To: <CAGg_6+OFUqxzy-3YErVKS0-4dU2TxLrJjev9TGWKOA1v8Lnp3g@mail.gmail.com>
X-Original-Sender: andrey.semashev@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 andrey.semashev@gmail.com designates 2607:f8b0:4003:c06::230 as permitted
 sender) smtp.mailfrom=andrey.semashev@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: <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:29175
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29175>

On Fri, Oct 28, 2016 at 1:17 AM, Nevin Liber <nevin@eviloverlord.com> wrote:
>
> There are three possibilities:
>
> 1. It is the same file according to the OS (e.g.: inode and device match).
> 2. It must have different contents according to the OS (e.g. the size doesn't
> match).

I think, the above two bullets cannot be implemented reliably. Event
the size may not be available if the source is read from a pipe.

> 3. The OS doesn't know if the files have the same content.  I'm pretty sure
> this would require an extra pass to compute the fingerprint hash, as you
> shouldn't be processing the file until you are sure it is unique.  You still
> have to scan for include guards as that is just normal macro processing.

As I shown earlier, basing the decision on the hash can result in
incorrect result. IMO, content equivalence is not the right criteria
for skipping file inclusion.

I think a proposal similar to the previously mentioned "#once
guard_phrase" has more potential. It does give the user a way to
indicate file equivalence (through the guard name) and also is
arguably less expensive than computing a hash value.

-- 
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/CAEhD%2B6BXvsZ%2BNJgnbX3yiGQWQRzWODYz-NfG8p3U%2B%2BAu90cKjA%40mail.gmail.com.

.
