public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: "Krzysztof Żelechowski" <giecrilj@stegny.2a.pl>
Cc: gcc Patches <gcc-patches@gcc.gnu.org>,
	"libstdc++" <libstdc++@gcc.gnu.org>
Subject: Re: [PATCH v2] libstdc++: improve documentation for bits/stl_function.h [PR51539]
Date: Wed, 18 Aug 2021 13:58:43 +0100	[thread overview]
Message-ID: <CACb0b4moF0S7-GEqhAY4H0VUjz0gM7xOdHCWASa9OGeMTzuMBg@mail.gmail.com> (raw)
In-Reply-To: <CACb0b4nRan5id5f6vpaEzEAmj55WmHUqMcN8SUJtwAn2pODHug@mail.gmail.com>

On Wed, 18 Aug 2021 at 13:49, Jonathan Wakely <jwakely@redhat.com> wrote:
>
> On Tue, 17 Aug 2021 at 21:39, Krzysztof Żelechowski
> <giecrilj@stegny.2a.pl> wrote:
> >    template<typename _Tp>
> >      struct greater : public binary_function<_Tp, _Tp, bool>
> >      {
> > +       /// Tests whether parameter 1 is greater (`operator>`) than parameter
> > 2.
>
> I don't like the use of "parameter 1" and "parameter 2" here. They
> have names, we can just say `x` and `y`.
>
> And if we're doing that, I wonder why we don't just say "@returns `x >
> y`" which is precise and correct. It's not accurate to say `operator>`
> because there is no such function for fundamental types, e.g.
> std::greater<int>()(1, 2) does not use a function called `operator>`
> it uses the built-in > operator. There is a distinction, and the way
> you're documenting it is not strictly correct.
>
> We could do that for every operator() that you're documenting.
> Personally I think that would be much better (and it's also how
> cppreference.com describes these).

Maybe the right compromise is to not mention `operator>` at all, but
combine prose and code like this:

/// Tests whether the first parameter is greater than the second
/// @returns `x > y`


  reply	other threads:[~2021-08-18 12:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-17 20:38 Krzysztof Żelechowski
2021-08-18 12:49 ` Jonathan Wakely
2021-08-18 12:58   ` Jonathan Wakely [this message]
2021-08-18 16:30   ` Jonathan Wakely

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=CACb0b4moF0S7-GEqhAY4H0VUjz0gM7xOdHCWASa9OGeMTzuMBg@mail.gmail.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=giecrilj@stegny.2a.pl \
    --cc=libstdc++@gcc.gnu.org \
    /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).