Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>
Cc: Andrew Burgess <aburgess@redhat.com>,
	gdb-patches@sourceware.org,
	Guinevere Larsen <guinevere@redhat.com>
Subject: Re: [PATCH] gdbserver: convert program_args to a single string
Date: Tue, 14 Jan 2025 12:34:49 -0500	[thread overview]
Message-ID: <ab73dd4f-56c5-449d-b524-334446ea5ad7@simark.ca> (raw)
In-Reply-To: <87ldvdqpgb.fsf@tromey.com>



On 2025-01-14 12:23, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:
> 
>>> /* Start a new process.
>>> PROGRAM is the program name.
>>> -   PROGRAM_ARGS is the vector containing the inferior's args.
>>> +   PROGRAM_ARGS is a string containing all the inferior's arguments.
>>> Returns the new PID on success, -1 on failure.  Registers the new
>>> process with the process list.  */
> 
> Simon> I think this comment should just be removed, there's no point in
> Simon> repeating the documentation from the base class.
> 
> FWIW I normally consider the "override" keyword to be sufficient
> documentation in these cases; though there's also some code with a
> comment pointing at the base class.

Speaking of this, I don't really know what to do in these situations, I'd like
if we could clarify what our style is.  Let's say you have:

-- base.h

struct base
{
  /* 1 */
  virtual void method ();
};

-- base.c

/* 2 */

void base::method ()
{
}

-- impl.c

struct impl : public base
{
  /* 3 */
  void method () override;
};

/* 4 */

void impl::method ()
{
}

Which comment should you have where?  We typically say "all declarations
and definitions should have a comment", but I feel like it's unnecessary here.

 - #1 is where you should have the documentation about the behavior of
   `method`
 - #2 would be the typical /* See base.h.  */, although I find these
   comments a bit useless
 - As you said, I think the `override` keyword is sufficient to make
   comment #3 unnecessary, unless you want to specify something specific
   to `impl`.  I don't see the need to point to the base class, that's
   just implied by how the language works.
 - I never know what to put for #4, you can't put /* See impl.c.  */,
   since you're already in impl.c.  Again, I feel like a "See whatever"
   comment is a bit useless: if you know C++, you know you need to go
   look at the declaration of struct/class `impl`.

Simon

  reply	other threads:[~2025-01-14 17:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-14 13:39 Andrew Burgess
2025-01-14 15:32 ` Simon Marchi
2025-01-14 17:23   ` Tom Tromey
2025-01-14 17:34     ` Simon Marchi [this message]
2025-01-14 23:07       ` Tom Tromey
2025-01-15 10:21       ` Andrew Burgess
2025-01-15 10:09   ` Andrew Burgess

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=ab73dd4f-56c5-449d-b524-334446ea5ad7@simark.ca \
    --to=simark@simark.ca \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=guinevere@redhat.com \
    --cc=tom@tromey.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