From: Jeffrey Walton <noloader@gmail.com>
To: cygwin@cygwin.com
Cc: Brian.Inglis@systematicsw.ab.ca
Subject: Re: Why does -std=c++11 hide certain function calls
Date: Thu, 06 Sep 2018 14:07:00 -0000 [thread overview]
Message-ID: <CAH8yC8=rGUHcHEKx21rNu2SiwpH9inr7uWFe-fXdVkg+LSC7zA@mail.gmail.com> (raw)
In-Reply-To: <CAJn6YFDfNZdr=r+MbNQcRsPyEf8K0-=SXN13Qt5p-m9t=u24Bw@mail.gmail.com>
On Thu, Sep 6, 2018 at 2:45 AM, John Selbie <jselbie@gmail.com> wrote:
>> For Unixy builds, just don't specify -std. Only specify -std if you want
> to ensure that builds will work with earlier standards, compilers, or
> libraries, or for -std=c* without any special language or library features,
> in which case you may also want to add -pedantic or more restrictive
> options.
>
> Ahhhh…. that was my mistake. I had erroneously assumed that not specifying
> -std would result in the oldest version of C++. A quick check:
>
> $ g++ foo.cpp -c -dM -E | grep cplus
> #define __cplusplus 201402L
>
> I was compiling with C++ 14 the whole time. And it appears that when -std
> is used, the GNU defines are taken out, which ultimately influence how
> POSIX_VISIBLE Is defined within <features.h>.
By default GCC uses a -std=gnu++NN, not -std=c++NN. So you are getting
mostly the latest C++ but it is GNU's flavor with non-standard things
like Variable Length Arrays (VLA's).
> I'm not sure if I agree that -std should hide the functions from unix
> headers. (tldr: unix headers are explicitly outside the c++ standard, so
> the moment they are included, you might as well assume the developer wants
> it all...)
Cygwin and Newlib conflate options in unexpected ways.
I think they are making incorrect leaps about options. For example if
you want Posix you may not want a GCC extension like VLA's. I doubt it
will change, though. You just have to work around it.
Jeff
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
prev parent reply other threads:[~2018-09-06 14:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-05 5:56 John Selbie
2018-09-05 18:46 ` Hans-Bernhard Bröker
2018-09-05 19:36 ` John Selbie
2018-09-05 20:41 ` Brian Inglis
2018-09-06 0:14 ` Doug Henderson
2018-09-06 6:45 ` John Selbie
2018-09-06 9:18 ` Csaba Raduly
2018-09-06 14:07 ` Jeffrey Walton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAH8yC8=rGUHcHEKx21rNu2SiwpH9inr7uWFe-fXdVkg+LSC7zA@mail.gmail.com' \
--to=noloader@gmail.com \
--cc=Brian.Inglis@systematicsw.ab.ca \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).