The Fuck Off AI Music Movement's FAQ is 👌
| Homepage | https://veralin.dk |
| GitHub | https://github.com/sqaxomonophonen |
| Pronouns | he/him or they/them |
| Birthyear / favorite tempo | 339ppm / 133bpm |
| Homepage | https://veralin.dk |
| GitHub | https://github.com/sqaxomonophonen |
| Pronouns | he/him or they/them |
| Birthyear / favorite tempo | 339ppm / 133bpm |
The Fuck Off AI Music Movement's FAQ is 👌
recording from the final seconds of nudel's life from another jammer
Galileo's Basilisk
https://hexmhell.writeas.com/galileos-basilisk
<- an eloquent counter to Rationalism, LessWrong, TESCREAL, the Singularity, the rise of AI and AGI, and what's more, it's fun!
@froos i've since found simple replacements for the remaining stuff i usually miss from libc:
qsort: i turned this macrofied qsort back into a stdlib.h-compatible one: https://github.com/nothings/stb/blob/31c1ad37456438565541f4919958214b6e762fb4/deprecated/stb.h#L8721-L8846
malloc/free: turns out the original K&R book ("The C Programming Language") chapter 8.7 has an elegant malloc, meant as a teaching example, but it works: https://github.com/noncombatant/kr-malloc/blob/main/original_kr_malloc.c
Defer available in gcc and clang
About a year ago I posted about defer and that it would be available for everyone using gcc and/or clang soon. So it is probably time for an update.
Two things have happened in the mean time:
I have not yet got my hands on the gcc implementation (but this is also less urgent, see below), but I have been able to use clang’s which is available starting with clang-22.
I think that with this in mind everybody developing in C could and should now seriously consider switching to defer for their cleanup handling:
I am not sure if the compiler people are also planning back ports of these features, but with some simple work around and slightly reduced grammar for the defer feature this works for me from gcc-9 onward and for clang-22 onward:
So this is already a large panel of compilers. Obviously it depends on your admissible compile platforms whether or not these are sufficient for you. In any case, with these you may compile for a very wide set of installs since defer does not need any specific software infrastructure or library once the code is compiled.
As already discussed many times, the gcc fallback uses the so-called “nested function” feature which is always subject of intense debate and even flame wars. Don’t worry, the implementation as presented here, even when compiled with no optimization at all, does not produce any hidden function in the executable, and in particular there is no “trampoline” or whatever that would put your execution at risk of a stack exploit.
You may also notice that there is no fallback for older clang version. This is because their so-called “blocks” extension cannot easily be used as a drop-in to replace nested function: their semantics to access variables from the surrounding scope are different and not compatible with the defer feature as defined by TS 25755.
So for example if you are scared of using big VLA on the stack, you may use the above code in headers and something like
double* BigArray = malloc(sizeof(double[aLot])); if (!BigArray { exit(EXIT_FALURE); } defer { free(BigArray); }to have an implementation of a big array with a failure mode for the allocation.
Or if you want to be sure that all your mutexes are unlocked when you leave a critical section, use and idiom as here
{ if (mtx_lock(&mtx) != thrd_success) { exit(EXIT_FAILURE); } defer { mtx_unlock(&mtx); } ... do something complicated ... if (rareCondition) { return 42; } ... do something even more complicated ... }Just notice, that you’d always have to use the defer feature with curly braces to ensure that the gcc fallback works smoothly.