bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org, Paul Eggert <eggert@cs.ucla.edu>
Cc: Bjarni Ingi Gislason <bjarniig@simnet.is>
Subject: Re: module c-nullptr: error compiling groff
Date: Mon, 06 Feb 2023 12:13:39 +0100	[thread overview]
Message-ID: <3559427.EukQKGxkVk@nimes> (raw)
In-Reply-To: <6b80b21b-1449-1de6-d8bb-b27a104c68c6@cs.ucla.edu>

Paul Eggert wrote:
> > +# ifdef __cplusplus
> > +/* For the C++ compiler the result of the configure test is irrelevant.
> > +   We know that at least g++ and clang with option -std=c++11 or higher, as well
> > +   as MSVC 14 or newer, already have nullptr.  */
> > +#  if !(((defined __GNUC__ || defined __clang__) && __cplusplus >= 201103L) \
> > +        || (defined _MSC_VER && 1900 <= _MSC_VER))
> <https://en.cppreference.com/w/cpp/language/nullptr> says nullptr is 
> part of C++11, so would it be better to omit the "(defined __GNUC__ || 
> defined __clang__) && "? It seems unlikely that a compiler would 
> advertise conformance to C++11 without supporting nullptr.

Unlikely?! You must be joking. We have seen so many occurrences where
compilers define __STDC_VERSION__ to a certain value without implementing
the corresponding standard entirely and correctly. Why should it be different
with __cplusplus? It is a common human behaviour to claim "we have XYZ!"
when in fact they only have 90% of XYZ.

In this particular case,
  - if we leave 'nullptr' alone although the compiler doesn't support it,
    there will be a compilation error quickly,
  - if we define 'nullptr' although the compiler supports it already, there
    are good chances that there will be no compilation error. (That's what
    I observed with all compilers except GCC.)
Therefore I did not want to make bets regarding C++ compilers that set
__cplusplus = 201103L but that I have not tested.


  reply	other threads:[~2023-02-06 11:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-06  0:22 module c-nullptr: error compiling groff Bjarni Ingi Gislason
2023-02-06  3:27 ` Bruno Haible
2023-02-06  5:10   ` Paul Eggert
2023-02-06 11:13     ` Bruno Haible [this message]
2023-02-07 21:50     ` Bruno Haible

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:

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3559427.EukQKGxkVk@nimes \
    --to=bruno@clisp.org \
    --cc=bjarniig@simnet.is \
    --cc=bug-gnulib@gnu.org \
    --cc=eggert@cs.ucla.edu \


* 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).