ChanServ changed the topic of #zig to: zig programming language | https://ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
<ifreund> uh, it just built
<ifreund> and worked i think
msingle has joined #zig
<ifreund> well, the test case from the issue works but my xdg shell generated code doesn't yet
<ifreund> which manages to compile https://paste.rs/1u4
<ifreund> the explicit types are needed, I don't think stage1 will ever have this feature without explicitly specifying the types of the globals
Norbertle has joined #zig
Gerbil has joined #zig
marler8997__ has joined #zig
marler8997_ has quit [Read error: Connection reset by peer]
Gerbil has quit [Remote host closed the connection]
kristoff_it has quit [Ping timeout: 256 seconds]
squeek502 has quit [Remote host closed the connection]
msingle has quit [Ping timeout: 260 seconds]
msingle has joined #zig
Kingsquee has joined #zig
jayschwa has quit [Remote host closed the connection]
ur5us has quit [Ping timeout: 260 seconds]
jjsullivan1 has quit [Remote host closed the connection]
<daurnimator> ps, andrew, i hope to get back on my older prs today
<daurnimator> pls don't close yet ;)
<andrewrk> you can always just renew them. closing just puts the ball back in your court
<andrewrk> I already have 61 balls, I think you could spare room for a couple :)
<daurnimator> so... everytime you close an issue/pr i disagree with i keep it open in a tab to remind me
<daurnimator> i now have.... ~40 tabs open. some over a year old :(
msingle has quit [Ping timeout: 272 seconds]
* fgenesis sigh
msingle has joined #zig
cr1901_modern has quit [Ping timeout: 240 seconds]
osa1 has joined #zig
cr1901_modern has joined #zig
mgxm has quit [Ping timeout: 264 seconds]
mgxm has joined #zig
radgeRayden has quit [Ping timeout: 272 seconds]
radgeRayden has joined #zig
msingle has quit [Ping timeout: 272 seconds]
osa1 has quit [Quit: osa1]
jjsullivan has joined #zig
osa1 has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
msingle has joined #zig
a_chou has quit [Remote host closed the connection]
leeward has quit [Remote host closed the connection]
semarie has quit [Ping timeout: 256 seconds]
semarie has joined #zig
CodeSpelunker has joined #zig
freshmaker666 has joined #zig
Norb has joined #zig
radgeRayden has quit [Ping timeout: 272 seconds]
radgeRayden has joined #zig
Norb has quit [Quit: Leaving]
cole-h has joined #zig
earnestly has quit [Ping timeout: 246 seconds]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
cole-h has quit [Quit: Goodbye]
cole-h has joined #zig
cole-h has quit [Client Quit]
marnix has quit [Remote host closed the connection]
marnix has joined #zig
cole-h has joined #zig
frett27_ has joined #zig
marnix has quit [Remote host closed the connection]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
CodeSpelunker has quit [Quit: CodeSpelunker]
msingle has quit [Ping timeout: 256 seconds]
Norbertle has quit [Quit: Leaving]
radgeRayden_ has joined #zig
radgeRayden has quit [Ping timeout: 272 seconds]
decentpenguin has quit [Read error: Connection reset by peer]
decentpenguin has joined #zig
Patrice_ has joined #zig
squeek502 has joined #zig
frett27 has joined #zig
frett27_ has quit [Ping timeout: 260 seconds]
Patrice_ has quit [Ping timeout: 240 seconds]
pruner has joined #zig
Baldr has joined #zig
earnestly has joined #zig
ur5us has joined #zig
pruner has quit [Quit: Konversation terminated!]
pruner has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
Baldr has left #zig [#zig]
cole-h has quit [Ping timeout: 240 seconds]
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
kristoff_it has joined #zig
OpenSpace has joined #zig
ur5us has quit [Ping timeout: 240 seconds]
tdc has joined #zig
tundrax has joined #zig
<tundrax> Is there an easy way to coerce zig `[]u8` to `[*c]const u8` when working with C library?
<ifreund> tundrax: no, because []u8 is not just a pointer, it has a length field as well
<ifreund> that means that []u8 is twice the size of a [*c]const u8 (or any other pointer
<ifreund> you can think of []u8 as a struct { ptr: [*]u8, len: usize }
<ifreund> you can of course pass my_slice.ptr to the C library, but make sure it doesn't expect a null terminator or something
<tundrax> so all C functions accepting `[*c]const u8` as parameter can be bassed `[]u8 slice.ptr`, right?
<pixelherodev> i think so
<ifreund> yes, though some may expect the pointer to be null terminated and read past the length of the slice
<ifreund> so you have to read the docs/code for the c function to know what is expected
pruner has quit [Remote host closed the connection]
<tundrax> Great, thank you.
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
marnix has quit [Ping timeout: 256 seconds]
marnix has joined #zig
masoudd_ has joined #zig
masoudd_ is now known as masoudd
tundrax has quit [Ping timeout: 245 seconds]
Kingsquee has quit []
tundrax has joined #zig
msingle has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
st4ll1 has joined #zig
tundrax has quit [Ping timeout: 245 seconds]
xackus has joined #zig
<u0jQx9gPyrYg> wow that's all i have to cast to `[*c]const u8` is to use `[]u8 slice.ptr`? i've been trying to figure that out, and i felt to stupid because i was unable to deduce that from the documentation.
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
msingle has quit [Ping timeout: 246 seconds]
azmr has joined #zig
<ifreund> pretty sure the docs explain slice.ptr and slice.len
<u0jQx9gPyrYg> i already feel stupid. no need to rub it in. :P
storyfeet has joined #zig
<storyfeet> hello
azmr has quit [Remote host closed the connection]
<storyfeet> So I'm not sure if this is the best place to ask my question, but I'll try anyhow.
<storyfeet> I'm just trying out Zig, and I've made some progress,
<storyfeet> I'm trying to use the termios library to switch to raw mode.
<storyfeet> const termios = std.c.termios;
<storyfeet> const std = @import("std");
<storyfeet> var t_attrs: u32 = 0; 16 termoios.tcgetattr(in, &t_attrs);
<storyfeet> var t_attrs: u32 = 0;termoios.tcgetattr(in, &t_attrs);
<storyfeet> (meant to be \n between them.
<storyfeet> but the error I get is :
<storyfeet> ./term.zig:16:12: error: container 'std.os.bits.linux.termios' has no member called 'tcgetattr' termios.tcgetattr(in, &t_attrs);
<Michcioperz> tcgetattr is defined on std.c
<Michcioperz> so i guess it should be std.c.tcgetattr(in, &t_attrs);
<Michcioperz> wait no
<Michcioperz> i think std.c.termios is a struct
<Ristovski> storyfeet: next time paste code into something like bpaste.net or pastebin, sending many messages induces throttling which means they get sent at a very slow rate
<Ristovski> not to mention it can clutter the channel
<storyfeet> sorry
<Ristovski> no worries :P
<storyfeet> thanks
<Michcioperz> yes, std.c.termios is a struct, and std.c.tcgetattr takes fd_t and *termios arguments
<Michcioperz> and returns an int
<storyfeet> I'm new to both systems, and trying to follow a c tutorial :https://viewsourcecode.org/snaptoken/kilo/02.enteringRawMode.html
<Michcioperz> well, t_attrs should be a termios
<Michcioperz> like, var t_attrs: termios = undefined;
<Michcioperz> then `std.c.tcgetattr(in, &t_attrs)` and check if it equals 0, if it doesn't, there was an error
<storyfeet> that makes sense, What's the build commmand to include std.c?
<Michcioperz> i'm not sure about that
<storyfeet> error: dependency on library c must be explicitly specified in the build command
<Michcioperz> what's your build command?
<storyfeet> currently just "zig run term.zig"
<Michcioperz> i guess you want -lc
<storyfeet> ok, that solves that, I'll keep plugging see what comes up. Thanks for the help
<Michcioperz> i love that manpage for tcgetattr doesn't specify what errors can come up
<Michcioperz> check errno they say
<ifreund> heh
<earnestly> As does the POSIX manual
<Michcioperz> wonderful
<Michcioperz> sorry, i shouldn't get so worked up
<u0jQx9gPyrYg> i think in your build.zig you can say `exe.linkLibC();` and then it links the c lib
<u0jQx9gPyrYg> on the other hand i'm a fresh noob that is still overwhelmed with this, so maybe i should wait a bit until i give advice, and let the more experienced help out.
<Michcioperz> yeah but that person wasn't using zig build
marnix has quit [Ping timeout: 264 seconds]
<Michcioperz> frankly i didn't realize we had a `zig run` haha
<storyfeet> lol
<Michcioperz> i almost always use zig build but i guess creating a project is a habit i got from rust
<storyfeet> nah, "cargo run" all the way
marnix has joined #zig
<storyfeet> the tutorial says to tweak c_lflag, and I see the docs page I have shows that existing, but I'm getting a
<storyfeet> ./term.zig:17:12: error: no member named 'c_lflag' in struct 'std.os.bits.linux.termios' t_attrs.c_lflag &= ~(c.ECHO);
<storyfeet> Is there somewhere else I can look to see extra info on the struct, , maybe from within zig?
<Michcioperz> are you on linux?
<Michcioperz> ^ is what i wanted to link to basically
<ifreund> or wait, no you want lflag
<Michcioperz> close enough
<Michcioperz> it is the struct definition
<ifreund> we just removed the c_ prefix for whatever reason
<Michcioperz> i think it was the right decision
<Michcioperz> imho those prefixes don't add that much value in a language that's not C
<ifreund> no, they really don't
<storyfeet> ah, OK, yes I'm on linux.
<Michcioperz> yeah then the struct definition is in that link up there
<ifreund> I'd recommend getting zls set up if you plan to do much zig development, it's quite helpful for exploring the standard library
<Michcioperz> you can't find it in the source file of std.c because std.os.bits.linux (or whatever os you're using) is imported inside std.c and then everything from inside it is copied and forwarded to show up as if it's a part of std.c
<Michcioperz> ifreund: personally i prefer running ripgrep on the whole std haha
<ifreund> oh I do a lot of that as well
<ifreund> but when zls works it's great
<Michcioperz> haven't really used language servers until i got a laptop that's not 10yo
<ifreund> yeah some like clangd will eat your memory and cpu
tundrax has joined #zig
<ifreund> zls is pretty light
marnix has quit [Ping timeout: 260 seconds]
<ifreund> though it's not as complete of course
marnix has joined #zig
masoudd has quit [Read error: Connection reset by peer]
<storyfeet> Got the terminal working raw now, really happy with that, thanks for all your help guys.
storyfeet has quit [Remote host closed the connection]
nullheroes has joined #zig
waleee-cl has joined #zig
<Michcioperz> i presume no one compiled the zig compiler to wasm yet?
TheLemonMan has joined #zig
teqwve has quit [Ping timeout: 260 seconds]
Wolf480pl has quit [Ping timeout: 260 seconds]
tane has joined #zig
Akuli has joined #zig
xackus_ has joined #zig
xackus has quit [Ping timeout: 258 seconds]
teqwve has joined #zig
Wolf480pl has joined #zig
a_chou has joined #zig
hnOsmium0001 has joined #zig
<ifreund> self hosted should be no problem, is there llvm for wasm though?
<nikki93> when i suspend / resume, is the "whole" stack saved or just the one for "this" function? eg. if i am passed a ptr into some buffer on the stack from the parent func, when i am resumed later can i still deref the ptr?
<fengb> It’s been attempted but not fully working yet
<nikki93> re: llvm in the browser, there's https://github.com/tbfleming/cib
<fengb> Last time I tried to sideload a libc in zig-bootstrap but ran into problems
<nikki93> there's also https://youtu.be/5N4b-rU-OAA
a_chou has quit [Ping timeout: 240 seconds]
<TheLemonMan> nikki93, only the local stuff is preserved
<nikki93> i see. this suspend resume stuff is kinda weird and interesting
cole-h has joined #zig
msingle has joined #zig
a_chou has joined #zig
radgeRayden_ has quit [Ping timeout: 272 seconds]
radgeRayden has joined #zig
<kristoff_it> Zig SHOWTIME starts in 30m, we're live with the preshow in the meantime: https://twitch.tv/kristoff_it\
<kristoff_it> ugh, correct link: https://twitch.tv/kristoff_it
<tdeo> has putting all the os-specific structs and definitions in a single place been considered/done?
<tdeo> like `const stat = switch (builtin.os) { .linux => struct {}, ... }`
<tdeo> i think i'd prefer that if there's no other issues i haven't thought of
<ifreund> that'd be kind of the reverse of the current situation
<tdeo> i don't like having the same struct being spread across many files
<tdeo> i think it's hard to notice when they're inconsistent, and hard to navigate with all the usingnamespace
<ifreund> I agree though, that'd make it easier to track stuff down due to reduced usingnamespace
<marler8997__> I'd like to start using Zig to make Windows applications, and I'd like to pad out the standard library with the missing windows functions while I do it
<marler8997__> This means I need to understand the std lib organization and I got some questions
<marler8997__> For example, why is there os/bits/windows.zig and os/windows/bits.zig?
<TheLemonMan> we're trying to add all the possible permutations
cole-h has quit [Quit: Goodbye]
cole-h has joined #zig
<marler8997__> anyone know what the purpose of "bits.zig" is in general?
<marler8997__> ok here's my guess...bits.zig is a place to hold const/type declarations that are used in multiple modules for an os?
<g-w1> does anyone know why zig run doesn't find system libraries but zig cc does? https://i.imgur.com/h9DTThu.png is this a bug?
<marler8997__> add "-lc"
<g-w1> ok.
<g-w1> thanks.
<TheLemonMan> bits holds the constants/typedefs for a given platform/os
<marler8997__> when would you put a const/typedef in bits vs in another os module?
<TheLemonMan> you should put all the platform/os specific stuff there
<marler8997__> for example, os\windows\sublang.zig contains alot of const declarations, why aren't they in os\bits\windows.zig?
<marler8997__> bad example, they are in bits.SUBLANG
<marler8997__> gdi32.zig, contains PIXELFORMATDESCRIPTOR, why isn't that in bits.zig?
<TheLemonMan> because nobody cares about windows (and nobody enforces any convention in the stdlib)
<marler8997__> ok, so you're saying it should be in bits.zig?
<marler8997__> user32 is a good example, it contains alot of const/typedefs
<TheLemonMan> yeah that's another can of worms, see #4426
<marler8997__> great thanks for that link, I had no idea whether Zig was aiming for partial or complete declarations, sounds like it's not decided
<marler8997__> in that case, I think it will be best to create my own windows declaration library
heitzmann has quit [Quit: The Lounge - https://thelounge.chat]
heitzmann has joined #zig
<marler8997__> TheLemonMan, and guidance for me?
<marler8997__> My thoughts for now is just to copy standard lib implementation, and add declarations as I need them
<marler8997__> But maybe I should implement more of a data-driven approach, where I generate the modules?
<TheLemonMan> my idea is to build a mechanically-generated third-party package
<TheLemonMan> covering the whole Win32 API by hand is ... well is nuts
<marler8997__> what would you use as the source for generating the modules?
<TheLemonMan> no idea, I doubt there's a canonical source for that
<tdeo> steal the rust definitions :)
<tdeo> probably a saner format than the headers
<TheLemonMan> I bet you can generate everything with a couple of lines of perl
msingle has quit [Ping timeout: 256 seconds]
tane_ has joined #zig
Wallbraker281 has joined #zig
Wallbraker281 has quit [Client Quit]
Wallbraker281 has joined #zig
tane_ has quit [Quit: Leaving]
tundrax has quit [Ping timeout: 245 seconds]
wootehfoot has joined #zig
wootehfoot has quit [Read error: Connection reset by peer]
Kingsquee has joined #zig
pruner has joined #zig
osa1 has quit [Ping timeout: 264 seconds]
layneson has joined #zig
haliucinas has quit [Remote host closed the connection]
haliucinas has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
wootehfoot has joined #zig
<alva> Would Wine be useful?
osa1 has joined #zig
cole-h has quit [Ping timeout: 240 seconds]
tdc has quit [Ping timeout: 272 seconds]
xackus_ has quit [Ping timeout: 260 seconds]
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
ur5us has joined #zig
st4ll1 has quit [Quit: WeeChat 2.9]
pruner has quit [Ping timeout: 260 seconds]
osa1 has quit [Quit: osa1]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
pruner has joined #zig
marnix has quit [Read error: Connection reset by peer]
xackus_ has joined #zig
adamkowalski has joined #zig
<adamkowalski> did something change with the latest master of the compiler?
<adamkowalski> I have a test that uses `std.meta.refAllDecls(@This());` and I get `error: unable to build stage1 zig object: CacheUnavailable`
frett27 has quit [Ping timeout: 265 seconds]
ur5us has quit [Ping timeout: 260 seconds]
pruner has quit [Ping timeout: 240 seconds]
wootehfoot has quit [Read error: Connection reset by peer]
ur5us has joined #zig
adamkowalski has quit [Quit: Lost terminal]
squeek502 has quit [Remote host closed the connection]
Akuli has quit [Quit: Leaving]
jjsullivan1 has joined #zig
a_chou has quit [Ping timeout: 258 seconds]
tane has quit [Quit: Leaving]
ur5us has quit [Remote host closed the connection]
ur5us has joined #zig
layneson has quit [Ping timeout: 246 seconds]
aw- has joined #zig
ur5us has quit [Ping timeout: 260 seconds]
tundrax has joined #zig
xackus_ has quit [Ping timeout: 240 seconds]
a_chou has joined #zig
g-w1 has quit [Quit: WeeChat 2.3]
g-w1 has joined #zig