Skip to content

Commit 2ef186a

Browse files
committed
Merge bitcoin/bitcoin#22881: doc: provide context for CNetAddr::UnserializeV1Array() and span.h with lifetimebound
33c6a20 span, doc: provide span.h context and explain lifetimebound definition (Jon Atack) d14395b net, doc: provide context for UnserializeV1Array() (Jon Atack) Pull request description: Add contextual documentation for developers and future readers of the code regarding - CNetAddr::UnserializeV1Array (see #22140) - Span and why it defines Clang lifetimebound locally rather than using the one in attributes.h ACKs for top commit: laanwj: Documentation review ACK 33c6a20 Tree-SHA512: cb8e6a6c23b36c9ef7499257e97c5378ec895bb9122b79b63b572d9721a1ae6ce6c0be7ad61bdf976c255527ae750fc9ff4b3e03c07c6c797d14dbc82ea9fb3a
2 parents d94dc69 + 33c6a20 commit 2ef186a

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/netaddress.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,12 @@ class CNetAddr
385385

386386
/**
387387
* Unserialize from a pre-ADDRv2/BIP155 format from an array.
388+
*
389+
* This function is only called from UnserializeV1Stream() and is a wrapper
390+
* for SetLegacyIPv6(); however, we keep it for symmetry with
391+
* SerializeV1Array() to have pairs of ser/unser functions and to make clear
392+
* that if one is altered, a corresponding reverse modification should be
393+
* applied to the other.
388394
*/
389395
void UnserializeV1Array(uint8_t (&arr)[V1_SERIALIZATION_SIZE])
390396
{

src/span.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@
3030

3131
/** A Span is an object that can refer to a contiguous sequence of objects.
3232
*
33-
* It implements a subset of C++20's std::span.
33+
* This file implements a subset of C++20's std::span. It can be considered
34+
* temporary compatibility code until C++20 and is designed to be a
35+
* self-contained abstraction without depending on other project files. For this
36+
* reason, Clang lifetimebound is defined here instead of including
37+
* <attributes.h>, which also defines it.
3438
*
3539
* Things to be aware of when writing code that deals with Spans:
3640
*
@@ -60,7 +64,7 @@
6064
* types that expose a data() and size() member function), functions that
6165
* accept a Span as input parameter can be called with any compatible
6266
* range-like object. For example, this works:
63-
*
67+
*
6468
* void Foo(Span<const int> arg);
6569
*
6670
* Foo(std::vector<int>{1, 2, 3}); // Works

0 commit comments

Comments
 (0)