From: Tom Tromey <tromey@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Joel Brobecker <brobecker@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [patch] Code cleanup: Make function typedef for find memory region
Date: Mon, 30 Aug 2010 18:38:00 -0000 [thread overview]
Message-ID: <m3tymcj69d.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20100830142507.GA1356@host1.dyn.jankratochvil.net> (Jan Kratochvil's message of "Mon, 30 Aug 2010 16:25:07 +0200")
>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
Jan> I am also for requiring comment to be placed at the function
Jan> definition and not at its declaration. Using tag jumps one will
Jan> never find the declaration and I have considered these functions to
Jan> have no comment (randomly found now
Jan> simple_displaced_step_copy_insn, it was a different function I had
Jan> the problem with).
I think there are three cases.
One case is the "bcache" case: you have a relatively simple data
structure with a defined public API. In this case, I find it it
convenient to be able to read the header file to see the entire exported
API, without being distracted by the implementation. This case is maybe
not as typical as we might like; many data types in gdb are semi-opaque
at best.
The second case is implementations of virtual methods. Here, the
comment belongs at the point of definition. I think commenting the
method implementation is actually (mildly) bad, because it means copying
documentation, with the problems that implies.
The last case is the rest of gdb -- semi-opaque data structures, utility
functions, etc. For these I think using the definition is preferable.
That said, my general rule for hacking on gdb is to just follow whatever
style is in use wherever I am hacking. If I were writing new code, I
might aspire to the bcache approach; but otherwise I just comment the
definition.
Jan> I am also for forbidding putting comments there at both places as
Jan> such way they get inconsistent soon or they differ etc. (randomly
Jan> found init_type).
I agree.
Tom
next prev parent reply other threads:[~2010-08-30 18:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-30 9:00 Jan Kratochvil
2010-08-30 10:44 ` Pedro Alves
2010-08-30 14:10 ` Joel Brobecker
2010-08-31 17:27 ` Jan Kratochvil
2010-08-31 18:12 ` Pedro Alves
2010-08-30 14:15 ` Joel Brobecker
2010-08-30 14:25 ` Jan Kratochvil
2010-08-30 14:58 ` Joel Brobecker
2010-08-30 15:04 ` Jan Kratochvil
2010-08-30 18:38 ` Tom Tromey [this message]
2010-08-31 13:02 ` Jan Kratochvil
2010-08-31 16:51 ` Tom Tromey
2010-08-31 17:13 ` Joel Brobecker
2010-08-31 17:33 ` Joel Brobecker
2010-08-31 18:09 ` Jan Kratochvil
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=m3tymcj69d.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.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