From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2 09/15] Add gdb::make_span overload and add necessary calls
Date: Sat, 14 Nov 2026 23:35:58 -0500 [thread overview]
Message-ID: <5277869e-9484-43b6-8002-8e33819fb1e5@simark.ca> (raw)
In-Reply-To: <25416d4b-bf12-4183-b1ce-c085e386e6f4@simark.ca>
On 2026-11-14 22:53, Simon Marchi wrote:
>
>
> On 2026-11-11 10:58, Tom Tromey wrote:
>> Currently the gdb code relies on gdb::span having a single-object
>> constructor and then making a span of 1 element from this object.
>> This isn't part of C++20, so this patch adds a new gdb::make_span
>> overload and then adds calls to this in various places as needed.
>>
>> I'm not completely sold on this particular overload. Perhaps it would
>> be better to require make_span(&x, 1).
>
> Arguments for make_span(&x, 1):
>
> - makes the intent explicit
> - easier transition to std::span(&x, 1)
>
>
> Arguments for make_span(x):
>
> - shorter to write
>
> I think I'd lean towards make_span(&x, 1), since this is close to what
> we'll have when we switch to always use std::span (assuming we don't
> keep that one gdb::make_span overload). But really I wouldn't mind
> either way.
It appears that:
std::vector<Foo> v;
gdb::make_span (v);
creates a `gdb::span<std::vector<Foo>>` of length 1, which I think can
be misleading. You'd probably notice because when trying to do anything
with the resulting span, it wouldn't behave as a span<Foo>, so you'd get
some compilation error, but still confusing. That makes me lean further
in favor of the explicit version.
Simon
next prev parent reply other threads:[~2026-11-15 4:36 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 15:58 [PATCH v2 00/15] Rename gdb::array_view to gdb::span Tom Tromey
2026-11-11 15:58 ` [PATCH v2 01/15] Rename array_view files Tom Tromey
2026-11-15 4:09 ` Simon Marchi
2026-11-16 15:55 ` Tom Tromey
2026-11-11 15:58 ` [PATCH v2 02/15] Rename gdb::array_view to gdb::span Tom Tromey
2026-11-15 4:18 ` Simon Marchi
2026-11-11 15:58 ` [PATCH v2 03/15] Rename gdb::make_array_view to gdb::make_span Tom Tromey
2026-11-11 15:58 ` [PATCH v2 04/15] Remove operator== and operator!= from gdb::span Tom Tromey
2026-11-11 15:58 ` [PATCH v2 05/15] Rename span::slice to span::subspan Tom Tromey
2026-11-11 15:58 ` [PATCH v2 06/15] Qualify calls to gdb::copy Tom Tromey
2026-11-11 15:58 ` [PATCH v2 07/15] Add single-argument overloads of process_options et al Tom Tromey
2026-11-11 15:58 ` [PATCH v2 08/15] Remove span from cli-option.c:build_help_option Tom Tromey
2026-11-15 3:40 ` Simon Marchi
2026-11-11 15:58 ` [PATCH v2 09/15] Add gdb::make_span overload and add necessary calls Tom Tromey
2026-11-15 3:53 ` Simon Marchi
2026-11-15 4:35 ` Simon Marchi [this message]
2026-11-16 16:55 ` Tom Tromey
2026-11-11 15:58 ` [PATCH v2 10/15] Don't turn rvalue reference into a span Tom Tromey
2026-11-11 15:58 ` [PATCH v2 11/15] Change span-selftests.c for C++20 Tom Tromey
2026-11-15 4:01 ` Simon Marchi
2026-11-15 5:15 ` Simon Marchi
2026-11-11 15:59 ` [PATCH v2 12/15] Make gdb::span conform more closely to C++20 Tom Tromey
2026-11-11 15:59 ` [PATCH v2 13/15] Allow the use of C++20 std::ranges in gdbsupport/ranges.h Tom Tromey
2026-11-15 5:18 ` Simon Marchi
2026-11-11 15:59 ` [PATCH v2 14/15] Allow the use of C++20 std::span in gdbsupport/span.h Tom Tromey
2026-11-15 4:05 ` Simon Marchi
2026-11-11 15:59 ` [PATCH v2 15/15] Move gdb::ranges::equal to gdbsupport/ranges.h Tom Tromey
2026-11-15 5:21 ` [PATCH v2 00/15] Rename gdb::array_view to gdb::span Simon Marchi
2026-11-17 21:42 ` 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=5277869e-9484-43b6-8002-8e33819fb1e5@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=tromey@adacore.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