Comment by lifthrasiir

1 day ago

    Zig, one of the giants upon whose shoulders this library stands, coined a name for this
    almost-but-not-quite-UTF encoding: WTF-8 and WTF-16. These encodings mean, simply, the
    same as their UTF counterpart but allowing unpaired surrogates to pass through.

To give credit where credit is due, both WTF-8 and WTF-16 were devised by Simon Sapin [1] and Zig simply picked them up.

[1] https://wtf-8.codeberg.page/

    sizeof((T){0} = $value)

Wait, is a compound literal an l-value in that sense (as opposed to, just being able to take its reference)?! Take a look at the C99 standard Oh my, it indeed is (C99 §6.5.2.5 p5). Good to know!

The WTF name really lies on the surface, there's no authoritative source of its origin.

I have a wtf.c from 10+ years ago when I was re-implementing Windows-style Unicode handling for some project. You keep running into various quirks, which accumulate and you inevitably arrive at your WTF moment. So WTF as name comes up naturally, no special wit required.

  • That might be possible, but Simon Sapin was who tried to specify what exactly are WTF encodings so that should mark sort of milestone.