urbanists.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
We're a server for people who like bikes, transit, and walkable cities. Let's get to know each other!

Server stats:

523
active users

#pointers

0 posts0 participants0 posts today
Felix Palmen :freebsd: :c64:<p>I would claim that I'm *very* experienced with <a href="https://mastodon.bsd.cafe/tags/programming" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>programming</span></a> in <a href="https://mastodon.bsd.cafe/tags/C" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>C</span></a>. But still, C gets annoyingly weird when it comes to <a href="https://mastodon.bsd.cafe/tags/pointers" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>pointers</span></a> *to* <a href="https://mastodon.bsd.cafe/tags/arrays" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>arrays</span></a>.</p><p>Does the following code look sober to you? 🤔 (My compiler doesn't complain)</p><p>Especially interested in the highlighted line, but also the block above trying to expand the array ...</p><p>Context: I started work on a generic/configurable rate-limiter to add to <a href="https://mastodon.bsd.cafe/tags/swad" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>swad</span></a>.</p>
andie :oh_no_bubble:<p>TIL: C array subscript operators are handled in such a way that `letters[i]` is equivalent to `*(letters + i)` and because addition is commutative, that expression is identical to `*(i + letters)`, which means that `i[letters]` is the same as `letters[i]`.</p><p>```<br><a href="https://tech.lgbt/tags/include" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>include</span></a> &lt;stdio.h&gt;<br><a href="https://tech.lgbt/tags/include" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>include</span></a> &lt;stddef.h&gt;</p><p>int main() {<br> char letters[3] = "abc";<br> size_t i = 2;<br> printf("letters: %p\n", (void *)&amp;letters);<br> printf("i[letters] (%p): %c\n", (void*)&amp;(i[letters]), i[letters]);<br> printf("letters[i] (%p): %c\n", (void*)&amp;(letters[i]), letters[i]);<br> return 0;<br>}<br>```</p><p>Which outputs:<br>```<br>letters: 0x7ffc68ec7bb9<br>i[letters] (0x7ffc68ec7bbb): c<br>letters[i] (0x7ffc68ec7bbb): c<br>```</p><p>Mind blown... :neofox_floof_explode: <br><a href="https://tech.lgbt/tags/til" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>til</span></a> <a href="https://tech.lgbt/tags/clang" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>clang</span></a> <a href="https://tech.lgbt/tags/pointers" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>pointers</span></a> <a href="https://tech.lgbt/tags/programming" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>programming</span></a></p>
BrianMy boy Lemmy along the Río Tomebamba. <a href="https://pixelfed.social/discover/tags/DogsOfMastodon?src=hash" class="u-url hashtag" rel="nofollow noopener noreferrer" target="_blank">#DogsOfMastodon</a> <a href="https://pixelfed.social/discover/tags/Dogs?src=hash" class="u-url hashtag" rel="nofollow noopener noreferrer" target="_blank">#Dogs</a> <a href="https://pixelfed.social/discover/tags/Pointers?src=hash" class="u-url hashtag" rel="nofollow noopener noreferrer" target="_blank">#Pointers</a> <a href="https://pixelfed.social/discover/tags/Cuenca?src=hash" class="u-url hashtag" rel="nofollow noopener noreferrer" target="_blank">#Cuenca</a> <a href="https://pixelfed.social/discover/tags/Ecuador?src=hash" class="u-url hashtag" rel="nofollow noopener noreferrer" target="_blank">#Ecuador</a>
Paul Houle<p>👇 Falsehoods programmers believe about null pointers</p><p><a href="https://purplesyringa.moe/blog/falsehoods-programmers-believe-about-null-pointers/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">purplesyringa.moe/blog/falseho</span><span class="invisible">ods-programmers-believe-about-null-pointers/</span></a></p><p><a href="https://mastodon.social/tags/programming" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>programming</span></a> <a href="https://mastodon.social/tags/software" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>software</span></a> <a href="https://mastodon.social/tags/pointers" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>pointers</span></a> <a href="https://mastodon.social/tags/zero" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>zero</span></a> <a href="https://mastodon.social/tags/null" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>null</span></a> <a href="https://mastodon.social/tags/errors" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>errors</span></a> <a href="https://mastodon.social/tags/billiondollarmistake" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>billiondollarmistake</span></a></p>