<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <updated>2026-10-26T04:54:09Z</updated>
  <generator>https://nostr.now</generator>

  <title>Nostr notes by wicked witch of the unix</title>
  <author>
    <name>wicked witch of the unix</name>
  </author>
  <link rel="self" type="application/atom+xml" href="https://nostr.now/npub1ku39qhads3p8a5tgr5krrwl30239z00v8xzqvnlxjtv6znmewwesr687t7.rss" />
  <link href="https://nostr.now/npub1ku39qhads3p8a5tgr5krrwl30239z00v8xzqvnlxjtv6znmewwesr687t7" />
  <id>https://nostr.now/npub1ku39qhads3p8a5tgr5krrwl30239z00v8xzqvnlxjtv6znmewwesr687t7</id>
  <icon>https://social.vlhl.dev/media/d0e5b2ebcfa8f0baf2d873e370ae22d56519931bdb9cd5c255c6af3ea843b730.jpg</icon>
  <logo>https://social.vlhl.dev/media/d0e5b2ebcfa8f0baf2d873e370ae22d56519931bdb9cd5c255c6af3ea843b730.jpg</logo>




  <entry>
    <id>https://nostr.now/nevent1qqsvr57w357w9kep48m5yc557s4kuqf4swj43magw7dq8fgl6tegm5szyzmjy5zl4kzyylk3dqwjcvdm79a2y5faasucgpj0u6fdng2009emx4kna44</id>
    
      <title type="html">as in like: ``` type foo; foo.nya = ...; foo.mew = ...; defer { ...</title>
    
    <link rel="alternate" href="https://nostr.now/nevent1qqsvr57w357w9kep48m5yc557s4kuqf4swj43magw7dq8fgl6tegm5szyzmjy5zl4kzyylk3dqwjcvdm79a2y5faasucgpj0u6fdng2009emx4kna44" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsy6nhukfyv26rcqe5udhjmjw2avklyfktpg02tt0m47qh8e0tdzusg683th&#39;&gt;nevent1q…83th&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;as in like:&lt;br/&gt;&lt;br/&gt;```&lt;br/&gt;type foo;&lt;br/&gt;foo.nya = ...;&lt;br/&gt;foo.mew = ...;&lt;br/&gt;defer {&lt;br/&gt;    free(foo.nya);&lt;br/&gt;    free(foo.mew);&lt;br/&gt;}&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;or? i&amp;#39;m not sure what &amp;#34;more local cleanup&amp;#34; would mean&lt;br/&gt;&lt;br/&gt;i&amp;#39;m going by the most common api pattern i see out there, that is, if `make_foo()` returns success, it means the struct was fully allocated, and free_foo() deallocates all it needs&lt;br/&gt;&lt;br/&gt;if make_foo() can fail, then i&amp;#39;d be something more like:&lt;br/&gt;&lt;br/&gt;```c&lt;br/&gt;type foo;&lt;br/&gt;if ((err = make_foo(&amp;amp;foo)))&lt;br/&gt;    return err;&lt;br/&gt;defer free_foo(foo);&lt;br/&gt;...;&lt;br/&gt;type nya;&lt;br/&gt;if ((err = make_nya(&amp;amp;nya, &amp;amp;foo)))&lt;br/&gt;    return err;&lt;br/&gt;defer free_nya(nya);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;(defer could also help inside those constructors, by a pattern like&lt;br/&gt;&lt;br/&gt;```c&lt;br/&gt;enum myerr err = OK;&lt;br/&gt;struct foo *foo = ...;&lt;br/&gt;&lt;br/&gt;defer if (err != OK) free_foo(foo);&lt;br/&gt;...;&lt;br/&gt;if (some_cond() == FAIL)&lt;br/&gt;    return (err = COND_FAILED);&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;ofc this also depends on your data structure for foo&lt;br/&gt;&lt;br/&gt;as a side note, for &amp;#34;handle every kind of failure&amp;#34;:&lt;br/&gt;&lt;br/&gt;it&amp;#39;s a lot better if you employ some sort of zii (zero is initialization), since then you can calloc() foo, (or for a stack structure, `foo = {};`) to zero it out; have free_foo cleanup when non-0 where possible, it&amp;#39;s one of the reasons `free(NULL);` is a noop&lt;br/&gt;&lt;br/&gt;i don&amp;#39;t have to care much *where* something failed and the destructor got called, since everything that wasn&amp;#39;t allocated would be a zero or some other value that can either be checked or noops (the only exception is usually fds where you have to assign -1, for this you can use a `foo = FOO_INIT;` macro, or just assign by hand, `foo = { .myfd = -1 }`, it&amp;#39;s annoying but works)
    </content>
    <updated>2026-10-11T09:42:53Z</updated>
  </entry>

  <entry>
    <id>https://nostr.now/nevent1qqswpqmfkrmdq0e88h0lah9qh50ltw40n2975tka9ec83ewsfrd7hmgzyzmjy5zl4kzyylk3dqwjcvdm79a2y5faasucgpj0u6fdng2009emxlrnedg</id>
    
      <title type="html">i don&amp;#39;t see how that constrains anything? deferred blocks ...</title>
    
    <link rel="alternate" href="https://nostr.now/nevent1qqswpqmfkrmdq0e88h0lah9qh50ltw40n2975tka9ec83ewsfrd7hmgzyzmjy5zl4kzyylk3dqwjcvdm79a2y5faasucgpj0u6fdng2009emxlrnedg" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsglawsu83y3tw5l300296nhdm4rgf4s52nc9js3tm6cqpf6rjc2xc68ewvu&#39;&gt;nevent1q…ewvu&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;i don&amp;#39;t see how that constrains anything? deferred blocks would be called on basically the same order as c&#43;&#43; destructors, plus you can defer whole blocks if you need more at cleanup time&lt;br/&gt;&lt;br/&gt;and i take&lt;br/&gt;&lt;br/&gt;```c&lt;br/&gt;type *foo = make_foo();&lt;br/&gt;defer free_foo(foo);&lt;br/&gt;// ...;&lt;br/&gt;if ((err = some_call()))&lt;br/&gt;    return err;&lt;br/&gt;type *nya = make_nya(&amp;amp;foo);&lt;br/&gt;defer free_nya(nya);&lt;br/&gt;&lt;br/&gt;if ((err = some_other_call()))&lt;br/&gt;    return err;&lt;br/&gt;//...;&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;over&lt;br/&gt;&lt;br/&gt;```c&lt;br/&gt;type *foo = make_foo();&lt;br/&gt;// ...;&lt;br/&gt;if ((err = some_call()))&lt;br/&gt;    goto cleanup_foo;&lt;br/&gt;// ...;&lt;br/&gt;type *nya = make_nya(&amp;amp;foo);&lt;br/&gt;&lt;br/&gt;if ((err = some_other_call()))&lt;br/&gt;    goto cleanup_nya;&lt;br/&gt;// ...;&lt;br/&gt;cleanup_nya:&lt;br/&gt;    free_nya(nya);&lt;br/&gt;cleanup_foo:&lt;br/&gt;    free_foo(foo);&lt;br/&gt;    return err;&lt;br/&gt;```&lt;br/&gt;&lt;br/&gt;for the defer example, i see foo, i see deferring it&amp;#39;s cleanup, i don&amp;#39;t think about foo&amp;#39;s resources on exit anymore&lt;br/&gt;&lt;br/&gt;on the goto example, i constantly have to think about it, if i change some calls around i gotta double check which labels it&amp;#39;s jumping to, it&amp;#39;s a lot easier to make a mistake refactoring and get a double-free or leak&lt;br/&gt;&lt;br/&gt;and to me, defer is not any less explicit, for the goto example if i&amp;#39;m looking at the cleanup at the end i have to be aware of every single point in the function that jumps to it, i have to personally keep track of allocation order to make sure cleanup order is correct (nya takes a foo, so foo *has* to be cleaned up later)&lt;br/&gt;&lt;br/&gt;defer just handles all that by design, all i have to do is keep the defer close to the allocation and now i don&amp;#39;t have to worry much about ordering on the 99% of common cases; it&amp;#39;s still explicit, it&amp;#39;s still there in the function telling me the flow, it&amp;#39;s not like destructors living in another file completely and being called implicitly&lt;br/&gt;&lt;br/&gt;(and sure defer isn&amp;#39;t idea on every case, it&amp;#39;s made to avoid common mistakes, just like we have `for (init; cond; end) body;` loops instead of `init; again: if (cond) goto over; body; end; goto again; over:`)
    </content>
    <updated>2026-10-11T09:23:15Z</updated>
  </entry>

  <entry>
    <id>https://nostr.now/nevent1qqsgkr94q372g2qsckqd0ekzymzf3plvg2qly09a2wckmy76jzmg78qzyzmjy5zl4kzyylk3dqwjcvdm79a2y5faasucgpj0u6fdng2009emx5tkcs7</id>
    
      <title type="html">reverse order when scope ends, it&amp;#39;s not much more confusing ...</title>
    
    <link rel="alternate" href="https://nostr.now/nevent1qqsgkr94q372g2qsckqd0ekzymzf3plvg2qly09a2wckmy76jzmg78qzyzmjy5zl4kzyylk3dqwjcvdm79a2y5faasucgpj0u6fdng2009emx5tkcs7" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsx7w4ey7jrrk34ny92nvgznrce7qqp35k5k3hrsxewelyynlc3psswdzx2k&#39;&gt;nevent1q…zx2k&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;reverse order when scope ends, it&amp;#39;s not much more confusing than the last expression in a for loop, imo&lt;br/&gt;&lt;br/&gt;(i also find it often clear than a sequence of goto cleanup_N; when you&amp;#39;re dealing with more than one exit point)
    </content>
    <updated>2026-10-11T08:47:24Z</updated>
  </entry>

  <entry>
    <id>https://nostr.now/nevent1qqsfaqu566s7smlzgn2kxm4uvaxe3d658ex00fqk4rdddteym6zayuczyzmjy5zl4kzyylk3dqwjcvdm79a2y5faasucgpj0u6fdng2009emxlwe904</id>
    
      <title type="html">when&amp;#39;s this whole &amp;#34;c is portable assembly&amp;#34; thing ...</title>
    
    <link rel="alternate" href="https://nostr.now/nevent1qqsfaqu566s7smlzgn2kxm4uvaxe3d658ex00fqk4rdddteym6zayuczyzmjy5zl4kzyylk3dqwjcvdm79a2y5faasucgpj0u6fdng2009emxlwe904" />
    <content type="html">
      when&amp;#39;s this whole &amp;#34;c is portable assembly&amp;#34; thing gonna end&lt;br/&gt;&lt;br/&gt;it&amp;#39;s just not
    </content>
    <updated>2026-10-11T08:39:35Z</updated>
  </entry>

  <entry>
    <id>https://nostr.now/nevent1qqsx7f9ul9n3q4ggnlly8vdh7tj423849h7388gjac2nha3cktka6sgzyzmjy5zl4kzyylk3dqwjcvdm79a2y5faasucgpj0u6fdng2009emx3snkqf</id>
    
      <title type="html">only valve and nintendo are trying new things with controllers, ...</title>
    
    <link rel="alternate" href="https://nostr.now/nevent1qqsx7f9ul9n3q4ggnlly8vdh7tj423849h7388gjac2nha3cktka6sgzyzmjy5zl4kzyylk3dqwjcvdm79a2y5faasucgpj0u6fdng2009emx3snkqf" />
    <content type="html">
      In reply to &lt;a href=&#39;/nevent1qqsfvherhy6s4vge8vkm9zqmkug44x02qduafrdlzduwm55ggrdvumqpwdjud&#39;&gt;nevent1q…djud&lt;/a&gt;&lt;br/&gt;_________________________&lt;br/&gt;&lt;br/&gt;only valve and nintendo are trying new things with controllers, tbh -- and valve is hitting it spot on with gyro and dual touchpads&lt;br/&gt;&lt;br/&gt;i&amp;#39;m not a fan of a law requiring a specific controller layout at all, everything would become an xbox controller&lt;br/&gt;&lt;br/&gt;if we have to have it, then i&amp;#39;d rather it be at most require adaptive icons in the ui like how steam does it, changing the displayed layout based on the controller being used, and nothing else
    </content>
    <updated>2026-05-19T00:06:05Z</updated>
  </entry>

</feed>