<andrewrk>
certainly there are codepaths where cleanup is hard to test, but for a lot of compiler tasks it's embarassingly testable
<ifreund>
Yeah, I saw that :)
<ifreund>
Someday when I have time I should try and set up something similar for river/wlroots
<ifreund>
wlroots is one of the C libraries that at least trys to care about allocation failure :)
ur5us_ has joined #zig
nycex has quit [Remote host closed the connection]
zags has quit [Ping timeout: 265 seconds]
nycex has joined #zig
kchambers has quit [Quit: WeeChat 3.0]
brzg has joined #zig
xackus__ has joined #zig
semarie has quit [Ping timeout: 258 seconds]
semarie has joined #zig
gazler_ has joined #zig
gazler has quit [Ping timeout: 256 seconds]
<v0idify>
if i have a thing that's `?c.a_c_type` how do i point to the inner non-null value? a bit confusing
<brzg>
the point of `?` is that it's not definite that there's an inner non-null value
<brzg>
so you'd need to use `thing orselse ...` or `thing.?` or `if (thing) |inner| { ... }`
<v0idify>
well, I want to un-null it and pass it to a C function to initialize it
<brzg>
if you're looking to get a *c.a_c_type
<v0idify>
that
<brzg>
`if (thing) |*inner| { ... }`
<v0idify>
yeah but !thing, it's null
<v0idify>
it starts off null and I want a pointer to init it
<brzg>
why do you need a pointer to initalise it but can't make it nonnull
<v0idify>
?
<brzg>
if you need a pointer to initalise it, you need to have it be nonnull
<v0idify>
the context is that I have a variable that contains c.FT_Library and it is lazily initialized when it's needed
<v0idify>
if i set the variable to undefined, would it be non-null and therefore allow a pointer?
<brzg>
it would be undefined and therefore you shouldn't rely on its value
<v0idify>
if (!thing) { thing = undefined; c.init(&thing.?); }
<mikdusan>
`var thing: ?c.FT_Library = null; var p = &thing; p.* = some_value;`
<v0idify>
but that's a pointer to the Optional
<brzg>
ah, another idea: make a variable of type `c.a_c_type`, pass its pointer to the c function, then transfer the initialised value into the `?c.a_c_type` variable
<v0idify>
ooh that could wokr
<v0idify>
kinda annoying but that'll do for now
brzg has quit [Quit: leaving]
ur5us has joined #zig
ur5us_ has quit [Ping timeout: 260 seconds]
SimonNa has quit [Ping timeout: 260 seconds]
SimonNa has joined #zig
swills has quit [Ping timeout: 260 seconds]
osa1_ has joined #zig
osa1 has quit [Ping timeout: 265 seconds]
swills has joined #zig
semarie has quit [Ping timeout: 272 seconds]
drawkula has joined #zig
semarie has joined #zig
yeti has quit [Ping timeout: 240 seconds]
jukan has joined #zig
jukan_ has quit [Ping timeout: 264 seconds]
drawkula is now known as yeti
xackus__ has quit [Ping timeout: 240 seconds]
euantorano has quit [Read error: Connection reset by peer]
waleee-cl has quit [Read error: Connection reset by peer]
jzelinskie has quit [Read error: Connection reset by peer]
shurane has quit [Read error: Connection reset by peer]
ovf has quit [Read error: Connection reset by peer]
hnOsmium0001 has quit [Ping timeout: 258 seconds]
larme has quit [Ping timeout: 272 seconds]
shurane has joined #zig
euantorano has joined #zig
larme has joined #zig
dyeplexer has joined #zig
jzelinskie has joined #zig
waleee-cl has joined #zig
ovf has joined #zig
hnOsmium0001 has joined #zig
remby has joined #zig
ur5us has quit [Ping timeout: 264 seconds]
_whitelogger has joined #zig
_fritchie has quit [Remote host closed the connection]
_fritchie has joined #zig
remby has quit [Quit: Connection closed]
remby has joined #zig
remby has quit [Quit: Connection closed]
edr has quit [Ping timeout: 260 seconds]
geemili has quit [Ping timeout: 264 seconds]
sord937 has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
decentpenguin has quit [Read error: Connection reset by peer]
decentpenguin has joined #zig
tnorth_ has joined #zig
SebastianM has joined #zig
osa1_ is now known as osa1
SebastianM has quit [Quit: -a- IRC for Android 2.1.59]
gazler_ has quit [Remote host closed the connection]
SebastianM has joined #zig
SebastianM has quit [Quit: -a- IRC for Android 2.1.59]
ur5us has joined #zig
tnorth_ has quit [Quit: Konversation terminated!]
BaroqueLarouche has quit [Quit: Idle for 30+ days]
ur5us has quit [Ping timeout: 264 seconds]
jokoon has joined #zig
SebastianM has joined #zig
cole-h has quit [Ping timeout: 256 seconds]
zags has joined #zig
SebastianM has quit [Quit: -a- IRC for Android 2.1.59]
WilhelmVonWeiner has quit [Ping timeout: 246 seconds]
gazler has joined #zig
p_____ has joined #zig
dyeplexer has quit [Ping timeout: 256 seconds]
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
<ifreund>
v0idify: I think you do var thing: ?c.FT_Library = @as(c.FT_Library, undefined); if (thing) |*t| c.ft_functionn(t);
p_____ is now known as dyeplexer
v0idify has quit [Ping timeout: 268 seconds]
v0idify has joined #zig
jokoon has quit [Quit: Leaving]
sord937 has quit [Remote host closed the connection]
sord937 has joined #zig
SebastianM has joined #zig
midgard has quit [Ping timeout: 265 seconds]
v0idify has quit [Ping timeout: 268 seconds]
midgard has joined #zig
wilsonk_ has quit [Read error: Connection reset by peer]
betawaffle has quit [Ping timeout: 240 seconds]
v0idify has joined #zig
kwilczynski has quit [Ping timeout: 240 seconds]
r0bby has quit [Read error: Connection reset by peer]
betawaffle has joined #zig
kwilczynski has joined #zig
r0bby has joined #zig
midgard has quit [Ping timeout: 260 seconds]
SebastianM has left #zig [#zig]
ifreund1 has joined #zig
ifreund has quit [Disconnected by services]
ifreund1 is now known as ifreund
midgard has joined #zig
betawaffle has quit [Read error: Connection reset by peer]
r0bby has quit [Read error: Connection reset by peer]
kwilczynski has quit [Read error: Connection reset by peer]
betawaffle has joined #zig
kwilczynski has joined #zig
r0bby has joined #zig
edr has joined #zig
GrooveStomp has quit [Quit: ZNC 1.7.2+deb3 - https://znc.in]
GrooveStomp has joined #zig
SebastianM has joined #zig
shurane has quit [Ping timeout: 272 seconds]
shurane has joined #zig
shurane has quit [Ping timeout: 246 seconds]
nvmd has joined #zig
shurane has joined #zig
nvmd has quit [Quit: Later nerds.]
shurane has quit [Read error: Connection reset by peer]
nvmd has joined #zig
remby has joined #zig
shurane has joined #zig
SebastianM has quit [Quit: -a- IRC for Android 2.1.59]
<DarkUranium>
Well, this one is actually just for Roslyn, but I rather like the idea. I think I might emulate it.
<zags>
mmm, nnn really improves the day
<v0idify>
ifreund, if i do thing = @as(c.FT_Library, undefined); it still thinks it's null
<v0idify>
is std.fs.File thread safe?
timeyyy has joined #zig
<ifreund>
v0idify: interesting
<ifreund>
I think that should work, unless c.FT_Library is a pointer type
<timeyyy>
andrewrk, I was inspired by your article "Announcing the Zig Software Foundation", I am also starting a non profit and would like to copy some of your sentances because they so elegantly say what I want to express. Would this be ok with you?
<v0idify>
ifreund, it is a pointer type! why wouldn't that work?
<timeyyy>
I plan to use them in an announcment post on the website for the NPO. I can also give you some credit and link to your website
midgard has quit [Quit: midgard disappears from view]
<ifreund>
timeyyy: I don't think you need permission to quote andrew's post, only if you pass it off as your own words without acknowledgement
<ifreund>
the website currently doesn't have a license though, we should fix that
<ifreund>
v0idify: optional pointers are the same size in memory as normal pointers and the 0 value is used to indicate null
<ifreund>
optional non-pointer types (and allowzero pointers) use a separate bool to store the null/non-null state
<ifreund>
v0idify: If you share the C header you're using I might be able to give better advice
<v0idify>
ifreund, it's from FreeType2, the type that it exports is a pointer by itself
<v0idify>
oh.. i just didn't have to put a ?
<ifreund>
yeah
<v0idify>
because it automatically turns into a ?*<inner type>
<ifreund>
[*c] may be null already
<ifreund>
or if the struct is opaque, then translate-c will output ?*
<ifreund>
I really hate C librarys that typdef pointer types...
<v0idify>
yeah kinda weird
<v0idify>
do we have something like github.com/ai/nanoid?
<ifreund>
we have plenty of crypto stuff in the std
<v0idify>
yes but i might have to make it myself for this
<ikskuh>
if you're the first user of nanoid in zig, i'd love to see the library ported :)
<v0idify>
don't make me do crypto stuff :P
<v0idify>
how am I supposed to seed a csprng?
<ifreund>
I think the std does that for you?
<ifreund>
just call e.g. std.crypto.random.int(i32)
<v0idify>
oh
<zags>
yeah std uses OS entropy
<ikskuh>
yeah i think you can trust std.crypto quite well (as long as you trust libsodium)
<v0idify>
somehow I made it panic: resumed an async function which already returned
<v0idify>
when calling random.bytes
donniewest1 has joined #zig
<ifreund>
are you using 0.7.1 or master?
<ifreund>
I think std.crypto.random got significantly better since 0.7.1
<jemius>
Hola. There is no pure Matrix-room, is there?
<motiejus>
#zig:matrix.org , though not as lively as this one
<jemius>
isn't that an IRC bridge?
<motiejus>
nope, that's a pure matrix room
<motiejus>
irc-bridged rooms in freenode are of the form `#freenode_#<channel>:matrix.org`
<motiejus>
(bridged by matrix.org, surely)
<jemius>
top
<jemius>
Since fosdem I'm wondering why I've never heard of Zig before. I've been trolling around in search for a C replacement for a while by now, Rust, Go, D
<ifreund>
andrewrk: went smoothly, just a few things in the wiki to update since linking is done by zig code not C++ now :)
<andrewrk>
nice
<andrewrk>
I'll let the CI do a run through since it tests cross compiling on a few different architectures
<andrewrk>
welcome jemius
<andrewrk>
provided you can tolerate some instability and immaturity, I think you've come to the right place :)
<jemius>
andrewrk, C is a hard nut to crack. We will see about that
<jemius>
Zig-Syntax isn't exactly trivial compared to C (not to speak of Go)
<geemili>
jemius: What do you mean by that? I was under the impression that zig was much easier to parse since it's more regular than C
jemius has quit [Read error: Connection reset by peer]