<alexnask[m]>
daurnimator: Loris had a PR with some initial changes to make the API the loop needs to expose a bit better
<pixelherodev>
Why does matrix do that? Ugh
<pixelherodev>
Hard to copy URLs from tmux+weechat
<andrewrk>
protheory8-new-m, I'm not sure what you're trying to demonstrate here - can you be more specific with your question?
<protheory8-new-m>
I'm trying to figure out how to launch async function from main, so I wonder if the code snippet that I sent is actually corrent
<protheory8-new-m>
probably not
<ikskuh>
protheory8-new-m: i think you're trying to understand "async" as "async spawns a thread, will be joined on await"
<protheory8-new-m>
Well I know that async function kinda returns back to callsite when `suspend` is reached and then it goes back when resuming if I understand correctly.
<protheory8-new-m>
ikskuh: not really I guess
decentpenguin has quit [Ping timeout: 256 seconds]
<ikskuh>
protheory8-new-m: okay good, just making sure ;)
cole-h has quit [Quit: Goodbye]
<andrewrk>
to understand async/await in zig, one must actually learn how the memory layout of async functions works. it is a little bit of investment, but it is worth it because you will have full knowledge of what you can and cannot do
<ikskuh>
daurnimator: where did you find that `..` is a valid file/path name on windows?
kushalp has quit [Ping timeout: 244 seconds]
karrick has quit [Ping timeout: 265 seconds]
tracernz has quit [Write error: Connection reset by peer]
procnto has quit [Read error: Connection reset by peer]
kwilczynski has quit [Ping timeout: 260 seconds]
r0bby has quit [Ping timeout: 272 seconds]
procnto has joined #zig
rzezeski has quit [Ping timeout: 244 seconds]
<daurnimator>
ikskuh: I recall it from somewhere. try with NtCreateFile?
<ikskuh>
documentation tells me that ".." is supposed the upper directory
<ikskuh>
maybe you discovered a bug? :D
kwilczynski has joined #zig
<daurnimator>
ikskuh: thats done in userspace in win32
karrick has joined #zig
r0bby has joined #zig
kushalp has joined #zig
BoilerOnAsurf has joined #zig
tracernz has joined #zig
rzezeski has joined #zig
<andrewrk>
sounds like we should do it in userspace in zig std lib? unless there's some reason to try to support that
<daurnimator>
andrewrk: yes.
<ikskuh>
current state is at least annoying, breaking pretty much all of my projects on windows :D
<daurnimator>
andrewrk: I think we might need a 'Path' type that could be e.g. `union (enum) { posix: []const u8, win32: []const u16, nt: []const u16}`
<andrewrk>
I'm not saying you're wrong necessarily, but that looks like something nightmarish
<ikskuh>
daurnimator: proper path type is probably more a []const []const T
<andrewrk>
isn't WTF-8 suitable for all platforms?
<daurnimator>
andrewrk: it does ends up in needless conversions back and forth
<daurnimator>
and we have an explosion of {open,move,etc}File{Z,W,blah}
<daurnimator>
ikskuh: I don't know about that....
<protheory8-new-m>
How do I init a C struct with default values in Zig?
BoilerOnAsurf has quit [Remote host closed the connection]
gpanders[m] has quit [Quit: Idle for 30+ days]
<daurnimator>
protheory8-new-m: what default values?
<alexnask[m]>
Yes, as long as `instance` is `var ` and not `const`
<protheory8-new-m>
Thanks
<alexnask[m]>
Depending on what the C code does there may be a better way to translate it than leaving the value undefined btw, but this is the direct translation :)
<daurnimator>
protheory8-new-m: C doesn't have default values.... so I don't think you're asking the question you think you are
<daurnimator>
for static storage things do get initialised to 0 in C...
<alexnask[m]>
For example, if the C uses an if/else and initializes with different values in each branch, you can just use an if/else expression (`var instance: StructName = if (...) .{ .x = 0, .y = 0 } else .{ .x = 255, .y = 255 }`)
pangey has quit [Ping timeout: 240 seconds]
pangey has joined #zig
_Vi has joined #zig
st4ll1 has joined #zig
BoilerOnAsurf has joined #zig
st4ll1 has quit [Quit: WeeChat 2.9]
rzezeski has quit [Quit: Connection closed for inactivity]
BoilerOnAsurf has quit [Remote host closed the connection]
ur5us has quit [Ping timeout: 240 seconds]
s-ol has joined #zig
_Vi has quit [Ping timeout: 246 seconds]
jmiven has quit [Quit: bye]
jmiven has joined #zig
st4ll1 has joined #zig
nycex has quit [Remote host closed the connection]
nycex has joined #zig
craigo_ has joined #zig
andrewrk has quit [Excess Flood]
craigo has quit [Ping timeout: 260 seconds]
andrewrk has joined #zig
st4ll1 has quit [Ping timeout: 240 seconds]
st4ll1 has joined #zig
waleee-cl has joined #zig
sawzall has quit [Read error: Connection reset by peer]
sawzall has joined #zig
_Vi has joined #zig
rzezeski has joined #zig
<fengb>
I've noticed that std.debug.panic isn't connected to `@import("root").panic`
<scientes>
fengb, I think it goes through a C symbol, right?
<fengb>
No, it triggers panicExtra directly
<fengb>
Which is what start.zig's default_panic triggers as well
<fengb>
But... shouldn't it go through the root panic? This is the only way in std to use a format string panic
Akuli has joined #zig
<scientes>
I only know that if you add a panic in the root you can get rid of all that ugly codegen
jorangreef has joined #zig
<ikskuh>
root panic is called by @panic afaik
<ikskuh>
std.debug.panic calls std.debug.panicExtra which calls @panic
<scientes>
yeah, that was my understanding (but I never read the code)
<jorangreef>
Hey everyone, I am new to Zig. What is the safest way to zero the memory of an extern struct? @memset(@ptrCast([*]align(8) u8, struct_ptr), 0, @sizeOf(@TypeOf(struct)));
<BaroqueLarouche>
std.mem.zeroes
<jorangreef>
I tried: struct_ptr.* = {} but one needs to specify all fields.
<fengb>
Nope, panicExtra directly exits
<fengb>
@panic calls default_panic which calls panicExtra
<fengb>
Which feels backwards
<fengb>
I'll create a new issue
<jorangreef>
Thanks BaroqueLarouche
dead10cc has joined #zig
nikita` is now known as ronja`
ronja` is now known as nikita`
dead10cc has quit [Quit: Konversation terminated!]
traviss_ has joined #zig
traviss has quit [Ping timeout: 260 seconds]
jorangreef has quit [Remote host closed the connection]
craigo_ has quit [Ping timeout: 246 seconds]
joey152 has joined #zig
<protheory8-new-m>
How do I ignore returned error?
<Nypsie[m]>
You can't
<Nypsie[m]>
Well, I suppose you could do myErrorSetFunction() catch {}
<protheory8-new-m>
What's the difference between `Fn` and `BoundFn` in `std.builtin.TypeInfo`?
<alexnask[m]>
BoundFns are expressions like `foo.bar` where `@TypeOf(foo)` has a `bar` function with a self parameter