From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: Subtle problems with "info sharedlibrary" on MS-Windows
Date: Thu, 8 Apr 2021 09:57:27 -0400 [thread overview]
Message-ID: <da3f2723-ae13-9c3f-9b33-d9abe5a3fc20@polymtl.ca> (raw)
In-Reply-To: <83czv59rw1.fsf@gnu.org>
On 2021-04-08 3:06 a.m., Eli Zaretskii wrote:
>> Cc: gdb-patches@sourceware.org
>> From: Simon Marchi <simon.marchi@polymtl.ca>
>> Date: Wed, 7 Apr 2021 17:18:08 -0400
>>
>>> OK to commit to master (with a suitable ChangeLog entry)?
>>
>> The patch LGTM, see minor comments below.
>
> Thanks for your prompt review (and for the other help in investigating
> this tricky problem).
>
>> According to our style guideline, we would use
>>
>> dll_name != nullptr
>
> Does this also mean the GDB style prefers, e.g.,
>
> if (load_addr == nullptr)
>
> to
>
> if (!load_addr)
>
> ? Because you didn't comment on those lines, only on those where the
> value is tested for NOT being null.
Exactly, sorry for not being clear. We always want explicit comparison
with nullptr for pointers, whether that is == or !=.
Same for integers that are not used as booleans, we want
if (item_count == 0)
and not
if (!item_count)
This is described here:
https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards#Comparison_With_nullptr_And_Zero
>>> + if (!(load_addr && mi.lpBaseOfDll != load_addr))
>>
>> Perhaps matter of personal preference, but I would understand it better
>> (less mental steps) as
>>
>> if (!load_addr || mi.lpBaseOfDll == load_addr)
>
> I feel the other way around, but maybe I'm the odd one out here.
> Pedro, Joel: what say you?
>
> In any case, I guess I could add a comment there explaining the logic
> in plain English, so everyone would understand the intent.
That's alright, leave it the way it is. But a comment explaining the
intent is always welcome, in my book.
Thanks,
Simon
next prev parent reply other threads:[~2021-04-08 13:57 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-10 12:36 Eli Zaretskii via Gdb-patches
2021-03-10 16:30 ` Hannes Domani via Gdb-patches
2021-03-10 16:51 ` Eli Zaretskii via Gdb-patches
2021-03-10 17:35 ` Hannes Domani via Gdb-patches
2021-04-05 17:51 ` Eli Zaretskii via Gdb-patches
2021-04-06 13:16 ` Eli Zaretskii via Gdb-patches
2021-04-07 21:18 ` Simon Marchi via Gdb-patches
2021-04-08 7:06 ` Eli Zaretskii via Gdb-patches
2021-04-08 13:57 ` Simon Marchi via Gdb-patches [this message]
2021-04-10 8:46 ` Eli Zaretskii via Gdb-patches
2021-04-10 15:03 ` Tom Tromey
2021-04-10 18:07 ` Eli Zaretskii via Gdb-patches
2021-04-10 22:56 ` Simon Marchi via Gdb-patches
2021-04-10 23:11 ` Simon Marchi via Gdb-patches
2021-04-11 7:10 ` Eli Zaretskii via Gdb-patches
2021-04-11 12:27 ` Simon Marchi via Gdb-patches
2021-04-11 18:43 ` Eli Zaretskii via Gdb-patches
2021-04-12 19:03 ` Tom Tromey
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=da3f2723-ae13-9c3f-9b33-d9abe5a3fc20@polymtl.ca \
--to=gdb-patches@sourceware.org \
--cc=eliz@gnu.org \
--cc=simon.marchi@polymtl.ca \
/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