220 19443 <mpdf0d$db2$1@ger.gmane.org> article
Path: news.gmane.org!not-for-mail
From: Matthew Woehlke <mwoehlke.floss@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Testing for supported features: Per-feature
 macros? Sentinel compilation?
Date: Thu, 30 Jul 2015 11:14:21 -0400
Lines: 69
Approved: news@gmane.org
Message-ID: <mpdf0d$db2$1@ger.gmane.org>
References: <e5919c40-d35e-4309-b5b8-6525a4eb443c@isocpp.org> <2435938.M1snUpQCpx@tjmaciei-mobl4> <32012d49-da47-4db6-b71c-ffcd09d10a45@isocpp.org> <1669023.4LeYva2qaW@tjmaciei-mobl4> <97f2e8e0-2ccf-4c96-8e23-73138dbd44e3@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Trace: ger.gmane.org 1438269285 15469 80.91.229.3 (30 Jul 2015 15:14:45 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 30 Jul 2015 15:14:45 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC37LBFWUIFBBWH65CWQKGQE5KWC4JQ@isocpp.org Thu Jul 30 17:14:37 2015
Return-path: <std-proposals+bncBC37LBFWUIFBBWH65CWQKGQE5KWC4JQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wi0-f197.google.com ([209.85.212.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC37LBFWUIFBBWH65CWQKGQE5KWC4JQ@isocpp.org>)
	id 1ZKpXX-0000i8-C4
	for gclcip-std-proposals@m.gmane.org; Thu, 30 Jul 2015 17:14:35 +0200
Original-Received: by wicmv11 with SMTP id mv11sf18978295wic.1
        for <gclcip-std-proposals@m.gmane.org>; Thu, 30 Jul 2015 08:14:34 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:to:from:subject:date:lines:message-id:references
         :mime-version:content-type:user-agent:in-reply-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=SA6GVSqT7FYEbZugIfVub9qUoMRKxNngNnrEJU2I2kg=;
        b=aFEllOouIOQBlKYusksCT/qhS3j4bNKp3I1NkYfK6BMGyWIw+hR8d3CFoByMpzawdp
         1qOsRCx4vpAhotMkZuF3BXRQJxl3Y3PW2AFg2PJbOXzCI2rIjUaGXzctAVDFksTOpVKY
         U0M8KI/Q4NVHOezu1l8WJ0jQAlzQMjivRl4kvq8fN1e8LkE/x7U2DmPMMCB/0j1kAw3k
         VUGWNpfKp9ISl5dD//xCqT5cYCqVAQBOFHsy8yXodtmGwQzb2kfb5kQFvr/tOm2Ybcak
         6XI29W1z9L0/qFzMYNQn/gvqf3bJ+8xoRmTQlBcxVhUICUbhAVO3Em8Z+WOtw/Fxlw30
         
X-Gm-Message-State: ALoCoQmTU7uZVJ435JG6oSiFwD8ZZqU8ZZNdJw4uZYNMetkK59NsyttWAAJX0XeqNK3ixkwZJgKz
X-Received: by 10.181.13.202 with SMTP id fa10mr1245596wid.4.1438269274784;
        Thu, 30 Jul 2015 08:14:34 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.152.45.73 with SMTP id k9ls175405lam.66.gmail; Thu, 30 Jul
 2015 08:14:31 -0700 (PDT)
X-Received: by 10.152.30.4 with SMTP id o4mr43722099lah.74.1438269271948;
        Thu, 30 Jul 2015 08:14:31 -0700 (PDT)
Original-Received: from plane.gmane.org (plane.gmane.org. [80.91.229.3])
        by mx.google.com with ESMTPS id o10si1036574laj.148.2015.07.30.08.14.31
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=RC4-SHA bits=128/128);
        Thu, 30 Jul 2015 08:14:31 -0700 (PDT)
Received-SPF: pass (google.com: domain of gclcip-std-proposals@m.gmane.org designates 80.91.229.3 as permitted sender) client-ip=80.91.229.3;
Original-Received: from list by plane.gmane.org with local (Exim 4.69)
	(envelope-from <gclcip-std-proposals@m.gmane.org>)
	id 1ZKpXS-0000eD-ID
	for std-proposals@isocpp.org; Thu, 30 Jul 2015 17:14:30 +0200
Original-Received: from tripoint.kitware.com ([66.194.253.20])
        by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
        id 1AlnuQ-0007hv-00
        for <std-proposals@isocpp.org>; Thu, 30 Jul 2015 17:14:30 +0200
Original-Received: from mwoehlke.floss by tripoint.kitware.com with local (Gmexim 0.1 (Debian))
        id 1AlnuQ-0007hv-00
        for <std-proposals@isocpp.org>; Thu, 30 Jul 2015 17:14:30 +0200
X-Injected-Via-Gmane: http://gmane.org/
Original-Lines: 60
Original-X-Complaints-To: usenet@ger.gmane.org
X-Gmane-NNTP-Posting-Host: tripoint.kitware.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
In-Reply-To: <97f2e8e0-2ccf-4c96-8e23-73138dbd44e3@isocpp.org>
X-Original-Sender: mwoehlke.floss@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of gclcip-std-proposals@m.gmane.org designates 80.91.229.3 as
 permitted sender) smtp.mail=gclcip-std-proposals@m.gmane.org;
       dmarc=fail (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-Spam-Checked-In-Group: 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:19443
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/19443>

On 2015-07-29 18:02, denis bider wrote:
> On 2015-07-29 15:26, Matthew Woehlke wrote:
>> You do realize that by the time the compiler sees the code,
>> the PP has already run? 
> 
> I thought actual implementation has already migrated away from this 
> concept? I thought this is now more so a fiction that's no longer true in 
> practice.

I wouldn't count on that, especially if you're using ccache. As I
understand it, ccache works by running the PP and comparing the output
hash and compile flags against its cache of previously-built objects. I
don't actually know if, when it needs to compile something, it passes
the original input to the compiler as opposed to the
already-preprocessed input.

Hmm... that said, you might be right in the sense that IIRC there are
"PP" directives that are left in place (e.g. #pragma), or even added
(e.g. #line). So maybe my previous comment doesn't apply. Disregard,
then :-).

> Even so - the *preprocessor* could invoke the compiler. This should be easy 
> if the probe code is independent of what comes before and after.

This could work. It may even be preferable (for one, if it worked this
way, it wouldn't break ccache if the result of the test changes).
However, making changes to the PP has historically met with a lot of
resistance.

>> In my experience, it's more typical that users are required
>> to use a compiler at least as capable as the one used
>> to build the library, and the library hard-codes what
>> features were enabled when it was built.
> 
> Crypto++ would like to use e.g. move semantics without preventing use with 
> VS 2005. My understanding is that Boost also desires to use the latest 
> language features, but still provide compatibility with compilers that lack 
> them (if I'm not mistaken, including VS 2005?).

*BUT*, do you mean that the library supports being compiled on an old
compiler? (That's fairly usual.) Or that the library supports being
built itself with a modern compiler and then used from an application
built with an old compiler? That may be possible, if you're very
careful, but you risk breakages due to the library having a different
notion than the application of what features are available.

On 2015-07-29 20:55, Thiago Macieira wrote:
> How often do you compile the library with VS 2010 (which supports move 
> semantics) and then compile the application with VS 2005? Answer: never.

You could be using a pre-built library that was built with a newer
compiler to build an application on a machine that has only an older
compiler. (Although, pre-built stuff tends to use the oldest compiler
possible, or be available built with multiple compiler versions.)

It *can* happen, but the library headers may well check for that and
raise an error.

-- 
Matthew

-- 

--- 
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/.

.
