mastodon.world is one of the many independent Mastodon servers you can use to participate in the fediverse.
Generic Mastodon server for anyone to use.

Server stats:

8.4K
active users

#struct

0 posts0 participants0 posts today
Habr<p>readonly struct в C#</p><p>Привет, Хабр! Вы, вероятно, уже сталкивались с struct в C# и задумались: а зачем нужен readonly struct и когда он реально спасает, а когда, наоборот, начинает всё тормозить? Сегодня это и рассмотрим.</p><p><a href="https://habr.com/ru/companies/otus/articles/905924/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">habr.com/ru/companies/otus/art</span><span class="invisible">icles/905924/</span></a></p><p><a href="https://zhub.link/tags/c" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>c</span></a># <a href="https://zhub.link/tags/struct" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>struct</span></a> <a href="https://zhub.link/tags/readonly_struct" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>readonly_struct</span></a></p>
Hacker News<p>Implementing a Struct of Arrays</p><p><a href="https://brevzin.github.io/c++/2025/05/02/soa/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">brevzin.github.io/c++/2025/05/</span><span class="invisible">02/soa/</span></a></p><p><a href="https://mastodon.social/tags/HackerNews" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>HackerNews</span></a> <a href="https://mastodon.social/tags/Implementing" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Implementing</span></a> <a href="https://mastodon.social/tags/a" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>a</span></a> <a href="https://mastodon.social/tags/Struct" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Struct</span></a> <a href="https://mastodon.social/tags/of" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>of</span></a> <a href="https://mastodon.social/tags/Arrays" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Arrays</span></a> <a href="https://mastodon.social/tags/C" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>C</span></a>++ <a href="https://mastodon.social/tags/Programming" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Programming</span></a> <a href="https://mastodon.social/tags/DataStructures" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>DataStructures</span></a> <a href="https://mastodon.social/tags/PerformanceOptimization" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>PerformanceOptimization</span></a></p>
Reverse-EngineeringЕще пара слов об устройстве NVRAM в UEFI-совместимых прош...<br><br><a href="https://habr.com/ru/articles/907488/?utm_source=habrahabr&amp;utm_medium=rss&amp;utm_campaign=907488" rel="nofollow noopener" target="_blank">https://habr.com/ru/articles/907488/?utm_source=habrahabr&amp;utm_medium=rss&amp;utm_campaign=907488</a><br><br><a rel="nofollow noopener" class="mention hashtag" href="https://mastodon.social/tags/Kaitai" target="_blank">#Kaitai</a> <a rel="nofollow noopener" class="mention hashtag" href="https://mastodon.social/tags/Struct" target="_blank">#Struct</a> <a rel="nofollow noopener" class="mention hashtag" href="https://mastodon.social/tags/dvar" target="_blank">#dvar</a> <a rel="nofollow noopener" class="mention hashtag" href="https://mastodon.social/tags/nvram" target="_blank">#nvram</a> <a rel="nofollow noopener" class="mention hashtag" href="https://mastodon.social/tags/uefi" target="_blank">#uefi</a> <a rel="nofollow noopener" class="mention hashtag" href="https://mastodon.social/tags/uefitool" target="_blank">#uefitool</a> <a rel="nofollow noopener" class="mention hashtag" href="https://mastodon.social/tags/reverse" target="_blank">#reverse</a> <a rel="nofollow noopener" class="mention hashtag" href="https://mastodon.social/tags/engineering" target="_blank">#engineering</a><br><br><a href="https://awakari.com/pub-msg.html?id=YfDd0S9MqLRDgGNQrxpIHSLbUuG&amp;interestId=Reverse-Engineering" rel="nofollow noopener" target="_blank">Result Details</a>
Habr<p>Порядок инициализации полей, статики и всего остального в C#</p><p>Всем привет! Многие сталкиваются с трудностями на собеседовании на вопросе по типу "Расскажите о порядке иницализации в C#". Либо банально когда видят квиз, стараются вспомнить, а что там должно инициализироваться? Сегодня многие вспомнят, а кто-то узнает о порядке инициализации. Затронем не только классы, а также структуры, а точнее - ключевое слово default для них. Сделаем следующие классы и посмотрим, что будет при создании объекта B:</p><p><a href="https://habr.com/ru/articles/886692/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">habr.com/ru/articles/886692/</span><span class="invisible"></span></a></p><p><a href="https://zhub.link/tags/c" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>c</span></a># <a href="https://zhub.link/tags/net" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>net</span></a> <a href="https://zhub.link/tags/net_core" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>net_core</span></a> <a href="https://zhub.link/tags/struct" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>struct</span></a> <a href="https://zhub.link/tags/%D0%B8%D0%BD%D0%B8%D1%86%D0%B8%D0%B0%D0%BB%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D1%8F" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>инициализация</span></a> <a href="https://zhub.link/tags/%D0%BF%D0%BE%D0%BB%D1%8F" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>поля</span></a></p>
Habr<p>Кастомная сериализация структур в UE</p><p>Допустим, вы создали свою USTRUCT в C++ и хотите её сериализовать. Обычно, достаточно просто пометить нужные поля как SaveGame . Но вот проблема, для этого эти поля сами должны поддерживать сериализацию. К сожалению одна из наших переменных не поддерживает сериализацию. В моем случае, это структура FNonSerializableStruct . Из-за этого сериализуется только вторая структура, хоть мы и пометили SaveGame обе.</p><p><a href="https://habr.com/ru/articles/865170/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">habr.com/ru/articles/865170/</span><span class="invisible"></span></a></p><p><a href="https://zhub.link/tags/usrtuct" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>usrtuct</span></a> <a href="https://zhub.link/tags/struct" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>struct</span></a> <a href="https://zhub.link/tags/serialize" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>serialize</span></a> <a href="https://zhub.link/tags/serializable" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>serializable</span></a> <a href="https://zhub.link/tags/%D1%81%D1%82%D1%80%D1%83%D0%BA%D1%82%D1%83%D1%80%D0%B0" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>структура</span></a> <a href="https://zhub.link/tags/%D1%81%D0%B5%D1%80%D0%B8%D0%B0%D0%BB%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D1%8F" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>сериализация</span></a> <a href="https://zhub.link/tags/unreal_engine" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>unreal_engine</span></a> <a href="https://zhub.link/tags/ue" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ue</span></a> <a href="https://zhub.link/tags/%D1%81%D1%82%D1%80%D1%83%D0%BA%D1%82%D1%83%D1%80%D1%8B" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>структуры</span></a> <a href="https://zhub.link/tags/%D0%B0%D0%BD%D1%80%D0%B8%D0%BB" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>анрил</span></a></p>
MetalSnake<p>In Swift I want to write a struct as a binary file, my struct looks like this:</p><p>struct Bitmap {<br> var bfh: BitmapFileHeader<br> var bih: BitmapInfoHeader<br> var imageData: Data<br>}</p><p>the BitmapFileHeader and BitmapInfoHeader contain only UInt32 and UInt16 variables.</p><p>Now it should be quite easy to write it with this:<br>let data = withUnsafeBytes(of: myStruct) { Data($0) }</p><p>but the imageData won't be written because it's from type Data.</p><p>Ok, so I have to write it like this:</p><p>withUnsafeBytes(of: myBMP.bfh) { data.append(contentsOf: $0) }<br>withUnsafeBytes(of: myBMP.bih) { data.append(contentsOf: $0) }<br>data.append(myBMP.imageData)</p><p>But that inserts padding so that every variable uses 4 bytes instead of what I defined.</p><p>So I have to write each variable like this:</p><p>withUnsafeBytes(of: myBMP.bfh.type) { data.append(contentsOf: $0) }<br>withUnsafeBytes(of: myBMP.bfh.size) { data.append(contentsOf: $0) }<br>and so on...</p><p>Seriously? Is there really no easy generic way to just write the Data as is?</p><p><a href="https://oldbytes.space/tags/swift" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>swift</span></a> <a href="https://oldbytes.space/tags/struct" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>struct</span></a></p>
НайменшенькийОголошення обмежень після класу/структури в C++
Orhun Parmaksız 👾<p>Derive more! 🔥 </p><p>🦀 derive_more: Derive traits for structs and enums to avoid boilerplate. </p><p>📚 Docs: <a href="https://docs.rs/derive_more" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">docs.rs/derive_more</span><span class="invisible"></span></a> </p><p>⭐ GitHub: <a href="https://github.com/JelteF/derive_more" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">github.com/JelteF/derive_more</span><span class="invisible"></span></a> </p><p><a href="https://fosstodon.org/tags/rustlang" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>rustlang</span></a> <a href="https://fosstodon.org/tags/derive" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>derive</span></a> <a href="https://fosstodon.org/tags/struct" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>struct</span></a> <a href="https://fosstodon.org/tags/enum" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>enum</span></a> <a href="https://fosstodon.org/tags/boilerplate" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>boilerplate</span></a> <a href="https://fosstodon.org/tags/programming" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>programming</span></a> <a href="https://fosstodon.org/tags/library" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>library</span></a> <a href="https://fosstodon.org/tags/opensource" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>opensource</span></a></p>
Mark Nichols (LGBTQIA+ Ally)<p>I like the second way better too. I also like the idea of splitting the struct and its impls to its own file. Thanks everyone for your input. </p><p><a href="https://hachyderm.io/tags/Rust" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Rust</span></a> <a href="https://hachyderm.io/tags/Trait" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Trait</span></a> <a href="https://hachyderm.io/tags/Impl" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Impl</span></a> <a href="https://hachyderm.io/tags/Struct" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Struct</span></a></p>
Mark Nichols (LGBTQIA+ Ally)<p>In Rust if I have some structs that each implement a couple traits, what is the preferred way to order things?</p><p>trait … {}<br>trait …{}</p><p>struct …{}<br>struct …{}<br>struct …{}</p><p>impl…for …{}<br>impl…for …{}<br>impl…for …{}<br>impl…for …{}<br>impl…for …{}<br>impl…for …{}</p><p>OR</p><p>trait …{}<br>trait …{}</p><p>struct …{}<br>impl…for …{}<br>impl…for …{}</p><p>struct …{}<br>impl…for …{}<br>impl…for …{}</p><p>struct …{}<br>impl…for …{}<br>impl…for …{}</p><p>OR, something else entirely?</p><p><a href="https://hachyderm.io/tags/Rust" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Rust</span></a> <a href="https://hachyderm.io/tags/Trait" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Trait</span></a> <a href="https://hachyderm.io/tags/Impl" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Impl</span></a> <a href="https://hachyderm.io/tags/Struct" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Struct</span></a></p>
Ramesh #NotGoingBack<p>⬆️ <span class="h-card" translate="no"><a href="https://mastodon.social/@gooba42" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>gooba42</span></a></span> </p><p>Another one of my favorites is carryover of <a href="https://mastodon.social/tags/struct" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>struct</span></a> from <a href="https://mastodon.social/tags/C" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>C</span></a>. </p><p>In <a href="https://mastodon.social/tags/Java" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Java</span></a>, everything is a class. Using one requires mem alloc from heap, and passed by reference, then later de-allocated. Mutable objects are costly in cycles, but also unsafe across threads.</p><p>Swift structs are immutable, passed by value on stack, no need to allocate and deallocate, and they can have functions/methods just like classes, but not overrideable. </p><p>Swift has a full complement of modern language constructs</p>
Найменшенький<p>Ніяк не міг зрозуміти чому наступний код не компілюється.</p><pre><code>template &lt;typename T, size_t N&gt; struct Arr { T[N] arr; T* begin() { return arr; } T* end() { return arr + N; } }; </code></pre><p>Хвилин пʼять сидів над ним якщо не довше.</p><p><a class="hashtag" href="https://social.net.ua/tag/cpp" rel="nofollow noopener" target="_blank">#cpp</a> <a class="hashtag" href="https://social.net.ua/tag/arrey" rel="nofollow noopener" target="_blank">#arrey</a> <a class="hashtag" href="https://social.net.ua/tag/class" rel="nofollow noopener" target="_blank">#class</a> <a class="hashtag" href="https://social.net.ua/tag/struct" rel="nofollow noopener" target="_blank">#struct</a> <a class="hashtag" href="https://social.net.ua/tag/template" rel="nofollow noopener" target="_blank">#template</a> <a class="hashtag" href="https://social.net.ua/tag/шаблони" rel="nofollow noopener" target="_blank">#шаблони</a> <a class="hashtag" href="https://social.net.ua/tag/масив" rel="nofollow noopener" target="_blank">#масив</a> <a class="hashtag" href="https://social.net.ua/tag/клас" rel="nofollow noopener" target="_blank">#клас</a> <a class="hashtag" href="https://social.net.ua/tag/структура" rel="nofollow noopener" target="_blank">#структура</a> <a class="hashtag" href="https://social.net.ua/tag/структури" rel="nofollow noopener" target="_blank">#структури</a></p>