# \#pointers

**URL:** https://forums.swift.org/tag/pointers/333.md?page=1

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

**Page:** 2

---

## [\[Accepted\] SE-0370: Pointer family initialization improvements and better buffer slices](https://forums.swift.org/t/accepted-se-0370-pointer-family-initialization-improvements-and-better-buffer-slices/60007)

<div class="topic-metadata">

**Author:** [@John\_McCall](https://forums.swift.org/u/John_McCall)\
**Replies:** 0\
**Last updated:** [August 31, 2022, 12:13am UTC](https://forums.swift.org/t/accepted-se-0370-pointer-family-initialization-improvements-and-better-buffer-slices/60007 "2022-08-31T00:13:20Z")

</div>

Hi, everyone. The review of SE-0370: Pointer family initialization improvements and better buffer slices is now complete. There was quite a bit of good feedback on this review. The community was strongly supportive of…

---

## [SE-0349: Unaligned loads and stores from raw memory](https://forums.swift.org/t/se-0349-unaligned-loads-and-stores-from-raw-memory/56423)

<div class="topic-metadata">

**Author:** [@John\_McCall](https://forums.swift.org/u/John_McCall)\
**Replies:** 10\
**Last updated:** [April 14, 2022, 2:34am UTC](https://forums.swift.org/t/se-0349-unaligned-loads-and-stores-from-raw-memory/56423 "2022-04-14T02:34:04Z")

</div>

Hello, Swift community. The review of SE-0349: Unaligned loads and stores from raw memory begins now and runs through April 12th, 2022. Reviews are an important part of the Swift evolution process. All review feedback …

---

## [\[Accepted\] SE-0349: Unaligned loads and stores from raw memory](https://forums.swift.org/t/accepted-se-0349-unaligned-loads-and-stores-from-raw-memory/56748)

<div class="topic-metadata">

**Author:** [@John\_McCall](https://forums.swift.org/u/John_McCall)\
**Replies:** 0\
**Last updated:** [April 14, 2022, 2:33am UTC](https://forums.swift.org/t/accepted-se-0349-unaligned-loads-and-stores-from-raw-memory/56748 "2022-04-14T02:33:11Z")

</div>

Hello, Swift community. The review of SE-0349 ended on April 12th. Feedback was quite light, but what was there was positive; a common theme was that this feature is long overdue. The Core Team agrees, and SE-0349 is …

---

## [What's the proper way to assign a UnsafeMutablePointer\<OpaquePointer\>](https://forums.swift.org/t/whats-the-proper-way-to-assign-a-unsafemutablepointer-opaquepointer/55312)

<div class="topic-metadata">

**Author:** [@coorfang](https://forums.swift.org/u/coorfang)\
**Replies:** 8\
**Last updated:** [February 16, 2022, 11:00am UTC](https://forums.swift.org/t/whats-the-proper-way-to-assign-a-unsafemutablepointer-opaquepointer/55312 "2022-02-16T11:00:45Z")

</div>

Hi all, I have a following opaque type defined in C code my\_client.h typedef struct MyClient MyClient; // to init void init\_my\_client(struct MyClient\*\* client\_ptr) { MyClient\* client = init\_impl() // when ca…

---

## [Inconsistent reference counting of UnsafeMutablePointer](https://forums.swift.org/t/inconsistent-reference-counting-of-unsafemutablepointer/54236)

<div class="topic-metadata">

**Author:** [@s-k](https://forums.swift.org/u/s-k)\
**Replies:** 5\
**Last updated:** [December 24, 2021, 6:47am UTC](https://forums.swift.org/t/inconsistent-reference-counting-of-unsafemutablepointer/54236 "2021-12-24T06:47:18Z")

</div>

I tried to implement a tree with copy-on-write behavior when I stumbled upon a strange reference counting inconsistency with UnsafeMutableBufferPointer and UnsafeMutablePointer : class A { deinit { print("d…

---

## [Stable pointer to a C String literal](https://forums.swift.org/t/stable-pointer-to-a-c-string-literal/53016)

<div class="topic-metadata">

**Author:** [@AlexanderM](https://forums.swift.org/u/AlexanderM)\
**Replies:** 11\
**Last updated:** [October 26, 2021, 9:02am UTC](https://forums.swift.org/t/stable-pointer-to-a-c-string-literal/53016 "2021-10-26T09:02:14Z")

</div>

Does Swift provide a way to store a C-string ( UnsafePointer\<CChar\> ) with a static lifetime? Something like a hypothetical: let s: UnsafePointer\<CChar\> = "abc" Where s has a stable pointer, pointing to a constant in t…

---

## [Write to slice of UnsafeMutableBufferPointer](https://forums.swift.org/t/write-to-slice-of-unsafemutablebufferpointer/52789)

<div class="topic-metadata">

**Author:** [@marcusrossel](https://forums.swift.org/u/marcusrossel)\
**Replies:** 5\
**Last updated:** [October 15, 2021, 10:06pm UTC](https://forums.swift.org/t/write-to-slice-of-unsafemutablebufferpointer/52789 "2021-10-15T22:06:36Z")

</div>

What is the correct way of writing a sequence of values into an UnsafeMutableBufferPointer? E.g. say we have: let buffer = UnsafeMutableBufferPointer\<UInt8\>.allocate(capacity: 16) buffer.initialize(repeating: 0) // bu…

---

## [\[Pitch\] Temporary uninitialized buffers](https://forums.swift.org/t/pitch-temporary-uninitialized-buffers/48954)

<div class="topic-metadata">

**Author:** [@grynspan](https://forums.swift.org/u/grynspan)\
**Replies:** 44\
**Last updated:** [August 27, 2021, 2:19am UTC](https://forums.swift.org/t/pitch-temporary-uninitialized-buffers/48954 "2021-08-27T02:19:44Z")

</div>

Hi folks! Long-time reader, first-time caller! This is my first pitch, so in addition to feedback about the concept, feel free to send me a direct message if you have any feedback on the structure/tone/etc. of this post.…

---

## [Data type returning wrong index values when sliced](https://forums.swift.org/t/data-type-returning-wrong-index-values-when-sliced/50790)

<div class="topic-metadata">

**Author:** [@quasarsunnix](https://forums.swift.org/u/quasarsunnix)\
**Replies:** 7\
**Last updated:** [August 2, 2021, 1:11pm UTC](https://forums.swift.org/t/data-type-returning-wrong-index-values-when-sliced/50790 "2021-08-02T13:11:49Z")

</div>

I'm trying to decode some binary chunks into various fixed width integers in iOS. The format of the abridged data features 5 UInt32s, followed by n amount of Int16s. Each chunk I receive features 1 initial byte of UInt8…

---

## [How to pass a pointer to a pointer safely?](https://forums.swift.org/t/how-to-pass-a-pointer-to-a-pointer-safely/47758)

<div class="topic-metadata">

**Author:** [@Timofey\_Solonin](https://forums.swift.org/u/Timofey_Solonin)\
**Replies:** 7\
**Last updated:** [May 6, 2021, 1:04pm UTC](https://forums.swift.org/t/how-to-pass-a-pointer-to-a-pointer-safely/47758 "2021-05-06T13:04:06Z")

</div>

I am working with launch\_activate\_socket function and have some trouble understanding whether I am using pointers in Swift correctly. The second argument of the launch\_activate\_socket function is named fds and has a typ…

---

## [Is it safe to use a variable after modifying via a rebound pointer?](https://forums.swift.org/t/is-it-safe-to-use-a-variable-after-modifying-via-a-rebound-pointer/44848)

<div class="topic-metadata">

**Author:** [@Karl](https://forums.swift.org/u/Karl)\
**Replies:** 5\
**Last updated:** [February 18, 2021, 7:27pm UTC](https://forums.swift.org/t/is-it-safe-to-use-a-variable-after-modifying-via-a-rebound-pointer/44848 "2021-02-18T19:27:27Z")

</div>

I have some code which is serialising a data type. The maximum length of the string is 40 bytes, and for various reasons I would like the ability to serialise in to a kind of fixed-size array. My serialisation code uses …

---

## [Can \`UnsafeMutablePonter\<T\>.moveInitialize(from:count:)\` be used with overlapping source and destination?](https://forums.swift.org/t/can-unsafemutableponter-t-moveinitialize-from-be-used-with-overlapping-source-and-destination/44161)

<div class="topic-metadata">

**Author:** [@Nickolas\_Pohilets](https://forums.swift.org/u/Nickolas_Pohilets)\
**Replies:** 1\
**Last updated:** [January 25, 2021, 11:02pm UTC](https://forums.swift.org/t/can-unsafemutableponter-t-moveinitialize-from-be-used-with-overlapping-source-and-destination/44161 "2021-01-25T23:02:05Z")

</div>

I have a buffer with elements ?ABCD (? - unitialized), and I want to move first 3 to get ABC?D. Can I use UnsafeMutablePonter\<T\>.moveInitialize(from:count:) for that? Is the following code a valid usage of this method? l…

---

## [The \`Data.init(bytesNoCopy:count:deallocator:)\` does not work as expected when \`Data\` is of representation of \`InlineData\`](https://forums.swift.org/t/the-data-init-bytesnocopydeallocator-does-not-work-as-expected-when-data-is-of-representation-of-inlinedata/40996)

<div class="topic-metadata">

**Author:** [@ylorn](https://forums.swift.org/u/ylorn)\
**Replies:** 12\
**Last updated:** [October 8, 2020, 7:23pm UTC](https://forums.swift.org/t/the-data-init-bytesnocopydeallocator-does-not-work-as-expected-when-data-is-of-representation-of-inlinedata/40996 "2020-10-08T19:23:52Z")

</div>

When the count of the bytes is no greater than 14 in a 64 system, or 6 in a 32 system, the initializer of Data.init(bytesNoCopy:count:deallocator:) does not work as expected as the label suggests: it makes a copy instead…

---

## [Help with some pointer code](https://forums.swift.org/t/help-with-some-pointer-code/35061)

<div class="topic-metadata">

**Author:** [@audulus](https://forums.swift.org/u/audulus)\
**Replies:** 10\
**Last updated:** [April 4, 2020, 5:19am UTC](https://forums.swift.org/t/help-with-some-pointer-code/35061 "2020-04-04T05:19:39Z")

</div>

I'm trying to write a decompression function. Encountering the struggle. Error is: Overlapping accesses to 'block', but modification requires exclusive access; consider copying to a local variable func Stream(blocks: D…

---

## [Two questions about pointers and performance](https://forums.swift.org/t/two-questions-about-pointers-and-performance/34133)

<div class="topic-metadata">

**Author:** [@Jens](https://forums.swift.org/u/Jens)\
**Replies:** 32\
**Last updated:** [February 28, 2020, 5:27pm UTC](https://forums.swift.org/t/two-questions-about-pointers-and-performance/34133 "2020-02-28T17:27:44Z")

</div>

While implementing a 2D hierarchical hash grid / spatial hashing data structure in Swift, and trying to optimize this function (defined only for i in 0 ... 6): func globalCellIndex(forGridIndex i: UInt8) -\> UInt32 { …

[Previous page](https://forums.swift.org/tag/pointers/333.md?match_all_tags=true&tags%5B%5D=pointers)
