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/
<pixelherodev> What's the libc target for windows/
<pixelherodev> ?
<pixelherodev> For cross-compilation
<pixelherodev> Is there no supported one?
dingenskirchen has quit [Read error: Connection reset by peer]
dingenskirchen has joined #zig
aerona has joined #zig
foobles has joined #zig
<foobles> how do a turn an LLVMValueRef representing an instance of some type T into an LLVMValueRef representing a pointer to T?
<foobles> I also have it as an IrInstGen
<foobles> do I just use result_loc?
<foobles> do I have to store it first?
_Vi has quit [Ping timeout: 272 seconds]
StateOff has joined #zig
dddddd has quit [Remote host closed the connection]
aerona has quit [Remote host closed the connection]
aerona has joined #zig
ur5us has joined #zig
frenata has quit [Remote host closed the connection]
nephele has quit [Ping timeout: 244 seconds]
nephele has joined #zig
metaleap has joined #zig
aerona has quit [Ping timeout: 244 seconds]
benjif has quit [Ping timeout: 264 seconds]
decentpenguin has joined #zig
klltkr_ has quit [Ping timeout: 264 seconds]
decentpenguin has quit [Quit: decentpenguin]
xackus_ has joined #zig
xackus has quit [Ping timeout: 244 seconds]
<Cadey> i wonder how far the TCP chat server example is from being an IRC server
<foobles> anyone here available to talk about generating LLVM IR? I am trying to unwrap an optional, which requires a pointer to the optional object, to do LLVMBuildGEP
<foobles> im not sure how to accomplish that
<foobles> also there are some strange things i'm seeing, like handle_is_ptr
<foobles> what does that actually check, when called on an optional type?
waleee-cl has quit [Quit: Connection closed for inactivity]
layneson has joined #zig
foobles has quit [Remote host closed the connection]
layneson has quit [Ping timeout: 260 seconds]
foobles has joined #zig
slowtyper has joined #zig
<andrewrk> pixelherodev, x86_64-windows-gnu or i386-windows-gnu
<andrewrk> foobles, have you seen this resource yet? http://llvm.org/docs/LangRef.html
<foobles> ......no
<foobles> thanks xD
<foobles> because most of this is not zig-specific righ?
<andrewrk> this describes LLVM IR. so there is a corresponding LLVMBuildFoo function for every instruction listed here
<foobles> awesome
<foobles> cool!
<andrewrk> the direct answer to your question is yes, none of this is zig specific
<foobles> i was just a bit surprised when I saw that ir_render_ref did a store to the result_loc
<foobles> also some of the zig helper functions seem to handle special cases that i dont understand, but Ill just try my best :v
<foobles> thanks :thumbsup:
ur5us has quit [Quit: Leaving]
ur5us has joined #zig
foobles has quit [Ping timeout: 240 seconds]
shodan45 has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
knebulae has quit [Ping timeout: 244 seconds]
knebulae has joined #zig
cole-h has quit [Quit: Goodbye]
StateOff has quit [Quit: Leaving]
kubkon has joined #zig
<pixelherodev> Thanks!
kubkon has quit [Ping timeout: 240 seconds]
kubkon has joined #zig
frett27_ has joined #zig
pystub has joined #zig
kubkon has quit [Ping timeout: 240 seconds]
pystub has quit [Ping timeout: 256 seconds]
kubkon has joined #zig
alexnask has joined #zig
butlerian has joined #zig
ur5us has quit [Ping timeout: 240 seconds]
FireFox317 has joined #zig
st4ll11 has quit [Quit: WeeChat 2.8]
Invader_Bork has joined #zig
ifreund has joined #zig
dtz has quit [Quit: killed]
Dominic[m] has quit [Quit: killed]
watzon has quit [Quit: killed]
ifreund[m] has quit [Quit: killed]
magejohn has quit [Quit: killed]
D3zmodos has quit [Quit: killed]
BitPuffin has quit [Quit: killed]
jorge-jbs has quit [Quit: killed]
Cadey has quit [Quit: killed]
fengb has quit [Quit: killed]
BaroqueLarouche has quit [Quit: killed]
basedtho has quit [Quit: killed]
afontain_ has quit [Quit: killed]
alva has quit [Quit: killed]
pmwhite has quit [Quit: killed]
pingiun[m] has quit [Quit: killed]
sammich has quit [Quit: killed]
Snektron has quit [Quit: killed]
AlexMax has quit [Quit: killed]
sammich has joined #zig
cow-orker has quit [Remote host closed the connection]
metaleap has quit [Quit: Leaving]
metaleap has joined #zig
metaleap has quit [Client Quit]
metaleap has joined #zig
ifreund[m] has joined #zig
pmwhite has joined #zig
fengb has joined #zig
afontain_ has joined #zig
BitPuffin has joined #zig
Dominic[m] has joined #zig
AlexMax has joined #zig
dtz has joined #zig
metaleap has quit [Client Quit]
metaleap has joined #zig
ur5us has joined #zig
cow-orker has joined #zig
ifreund has quit [Read error: Connection reset by peer]
ifreund has joined #zig
kubkon has quit [Ping timeout: 240 seconds]
dingenskirchen1 has joined #zig
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen1 is now known as dingenskirchen
dingenskirchen has quit [Client Quit]
dingenskirchen has joined #zig
ifreund has quit [Read error: Connection reset by peer]
ifreund has joined #zig
Kingsquee has quit [Quit: Konversation terminated!]
dddddd has joined #zig
<alexnask> andrewrk, Are there any plans to change the way generic functions are type erased in stage2?
<alexnask> More specifically, currently every arg after the first generic arg (+ the return type) are erased, I believe it would be more convenient for metaprogramming code to only erase generic args (and the return type if it depends on them)
<alexnask> Sorry if I've missed some issue or discussion on this, I looked at the issue tracker but can't find anything relevant
<mikdusan> fn(type,var,var) var
<mikdusan> and maybe require `comptime` keyword for each comptime arg
_Vi has joined #zig
<ikskuh> mikdusan: i don't think that was alexnask' point
<mikdusan> which part? the comptime?
<alexnask> By 'erased' I am talking about the type turning to 'var'
<ikskuh> two functions:fn(size: usize, comptime T: type)
<ikskuh> and
<ikskuh> fn(comptime T: type, size: usize)
<ikskuh> second one has signature fn(type,var), first one has fn(usize,type)
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen has joined #zig
<mikdusan> ikskuh: all I'm saying is (probably because of) type erasure, `fn(comptime T0: type, T1: type)` is allowed today. there's a smell to that.
<alexnask> Wait, this actually compiles? I thought ccomptime only types needed to be comptime to appear as arguments
<mikdusan> 2nd, 3rd,.... comptime keyword not required afaik
<alexnask> Right, it could be that the check happens after they are erased?
<alexnask> I should look into the funcdecl code in detail
<mikdusan> right, so this is particularily odd to me... `fn(one: bool, comptime T0: type, T1: type)`
FireFox317 has quit [Ping timeout: 256 seconds]
marijnfs has joined #zig
<marijnfs> Is it feasible now to add external cpp libraries by source, like you might a c library in Zig?
<marijnfs> since zig can do c++ now right?
<mikdusan> marijnfs: there were some recent successes with that but couple of caveats; it's fairly new and since this is c++ we are talking about, any other native dep (recursively) using c++ must also be built with zig
<ikskuh> marijnfs: my experience is that you have to add all deps then
<ikskuh> but it's worth it for crosscompilation :)
<tdeo> if i have a ZigTypeIdPointer pointing to a single element, i can use ir_read_const_ptr to read the value from it. but what if i have one to multiple items (from a slice)?
<tdeo> oh, maybe i can change ConstPtrValue.data.base_array.elem_index?
<mikdusan> slices are repr as structs with 2 fields. [slice_ptr_index] [slice_len_index]
<tdeo> yeah i have that part already, but i'm struggling with using the ptr value from it
ur5us has quit [Ping timeout: 252 seconds]
<mikdusan> maybe this will help: inside ir_analyze_ptr_cast() look for `// For slices, follow the `ptr` field` and how it sets up ir_analyze_struct_field_ptr()
st4ll1 has joined #zig
FireFox317 has joined #zig
wootehfoot has joined #zig
riba has joined #zig
<marijnfs> mikdusan: ikskuh: I see, interesting
<marijnfs> I basically had this issue that I was linking from build.zig to libc++, but the library I linked to was probably built with another version and I got crazy crashes
<marijnfs> took ages to figure out, but I figure these issues would be relieved if I build the whole library in my project directly.
<marijnfs> Or stop blindly linking to libc++
riba has quit [Ping timeout: 246 seconds]
<tdeo> can someone who knows the compiler review #5203 thanks
dingenskirchen has quit [Remote host closed the connection]
dingenskirchen has joined #zig
jaredmm_ is now known as jaredmm
Snektron has joined #zig
dimenus has joined #zig
dimenus has quit [Remote host closed the connection]
<FireFox317> yo, anyone in here knows a good single board computer (like raspberrypi) but that doesnt have a close source gpu/bootloader and has good documentation?
ifreund has quit [Quit: WeeChat 2.8]
BaroqueLarouche has joined #zig
<FireFox317> i'm interested in low level stuff, but the raspberry pi is just so annoying to work with since broadcom -_-
<ikskuh> FireFox317: relatable
<ikskuh> but i would not use a SBC on PI level
<ikskuh> those SOCs are so large-scale that it's a pain to work with
<FireFox317> i mean there should be SOCs that have good documentation and stuff right?
<ikskuh> hah you wish
<ikskuh> there are SOCs
<ikskuh> but smaller ones
<ikskuh> as soon as you have a GPU on board, it's mostly "boots linux with blob"
<FireFox317> hmm yeah i see, so what with smaller socs you are more talking about stm32 stuff i think?
dimenus has joined #zig
<ikskuh> yeah
<ikskuh> there was one board though
<ikskuh> ultra-high powered soc
<ikskuh> cost-level of stm32
<FireFox317> maybe rpi is the easiest then because there has been quite some research to the videocore and stuff
<ikskuh> yeah probably
<fengb> I've been thinking about getting a toy FPGA
<ikskuh> fengb: prepare for trouble
<ikskuh> "learn programming anew"
<fengb> Then you can deal with your own bootloader! :P
<ikskuh> also, reserve ~20GB of your disk then
<fengb> ikskuh: aren't you supposed to be pimping out your new CPU?
<dimenus> RPI also just recently released the actual datasheet for the rpi4
<BaroqueLarouche> Get a DE10 Nano so you can run MiSTer too
<ikskuh> and prepare for *really bad tooling*
<dimenus> the downside being QEMU doesn't really support the rpi4
<FireFox317> yeah i'm also thinking about getting a fpga maybe, there are some nice xilinx socs that have an arm and an fpga in a single package.
<ikskuh> it's quite cool and the altera/intel toolchain is okayish
<FireFox317> However yeah tooling is so annoying
<ikskuh> yep
<ikskuh> <fengb> ikskuh: aren't you supposed to be pimping out your new CPU?
<FireFox317> I like how there are more people working on open source fpga tooling now
<ikskuh> I'm "working" :D
<ikskuh> will continue reimplementing my assembler in zig later
<ikskuh> fengb: I'm developing my computer on this board: https://www.latticesemi.com/products/developmentboardsandkits/machxo3lfstarterkit
<ikskuh> cheap and has a lot of I/O
<ikskuh> but has *no* builtin periphery
<fengb> Actually... isn't HDMI pretty proprietary?
<FireFox317> no? dont think so
<ikskuh> yep
<ikskuh> it is
<FireFox317> oh
<ikskuh> HDMI costs per-device afaik
<ikskuh> DisplayPort and VGA are open
<ikskuh> Thanks VESA!
<FireFox317> Ah lattice, they have some fpga chips that are completely reversed enigneered by people <3
<ikskuh> yep
<ikskuh> lattice is nice anyways
<ikskuh> cheap chips
<ikskuh> not that powerful, but 20$ per chip is okay
<fengb> Oh I forgot about DP
<ikskuh> i still do gool ol' vga
<ikskuh> because it's WAY easier than anything newer
Cadey has joined #zig
chapl has joined #zig
<nephele> I wonder, does zig allow for comments aimed at code editors only?
<nephele> I was thinking about hungarian notation and so, in many cases knowing immidiently what a variable belongs to (and where it doesn't belong) could be quite powerfull
<nephele> But i would like to do this with colors instead of a text notation, so basically telling my editor somehow "this var be red!"
<chapl> Somebody mind helping me out real quick? Just a tini tiny issue. `var cursor: i32 = 1;` and `cursor += 1;` doesn't actually increment the cursor by one, but by three instead. At least that's what `io.getStdOut().outStream().print()` is telling me.
<ikskuh> huh
<ikskuh> it should not…
<chapl> Wanna see the code? Maybe I made some stupid newbie mistake. It's about 21 lines.
<ikskuh> yeah, send it over with bpaste
<chapl> ikskuh: https://bpaste.net/PKEA
<chapl> [25] mcstore>
<chapl> [27] mcstore>
<chapl> Sometimes by two, sometimes by three
<ikskuh> note that it will output 1024 zeroes every time!
<chapl> I'm aware of that. I'll fix that later. :)
<ikskuh> okay
<ikskuh> also, entering '1\r' will yield two bytes ;)
foobles has joined #zig
<chapl> OHHH
<chapl> fuck me
<ikskuh> readByte will read the char entered as well as the carriage return
<ikskuh> hey foobles!
<foobles> yo!
<foobles> :)
<chapl> Thank you ikskuh!
<foobles> :)
<chapl> But that doesn't actually fix the integer inc issue I have
<ikskuh> why?
<chapl> Did you have a look at the code? Line 19: `answer_cursor += 1;` - I don't read the integer in. I just do plain integer addition and instead of +1 I get +2 and sometimes +3
r4pr0n has joined #zig
<mikdusan> 1\r\n is 3 bytes
<ikskuh> yes
<ikskuh> the error is '\r'
<ikskuh> you will just override your first increment with the second
<ikskuh> and it's so fast you can't see that
<chapl> Oh now I get it. \r and \n account as separate read bytes.
<ikskuh> yeah, sure ;)
<chapl> That makes sense. Alright. Thank you. Much obliged!
puzzleddev has joined #zig
<scientes> are zig programs PIE?
<scientes> is there such thing as static-linked PIE?
<scientes> and you could just run it by jumping to it
<nycex> scientes: you can use zig build-exe -fPIE, then it is
<scientes> and how do you know the entry point?
<scientes> i.e. could you load it from another program without exec()?
<nycex> uhm nvm i confused it with PIC
<scientes> I guess it still is an ELF with a number of sections
<scientes> nycex, they are very similar
<scientes> wait, but the loader does most of the ELF handling
<scientes> I guess the kernel does some too
<nycex> scientes: I know, but i'm not sure if -fPIC does what you want
<scientes> ./fs/binfmt_elf.c
<mikdusan> scientes: I believe what happens is the elf loader decides base address to load at. being pic/pie, the baseaddr doesn't matter. then elf is used to figure offsets and determine entry
<scientes> linux/fs/binfmt_elf.c
layneson has joined #zig
waleee-cl has joined #zig
Akuli has joined #zig
tdeo has quit [Quit: Quit]
tdeo has joined #zig
chapl has quit [Quit: Leaving]
cole-h has joined #zig
wootehfoot has quit [Read error: Connection reset by peer]
alva has joined #zig
ifreund has joined #zig
ifreund1 has joined #zig
puzzleddev has quit [Remote host closed the connection]
puzzleddev has joined #zig
ifreund has quit [Ping timeout: 260 seconds]
r4pr0n has quit [Remote host closed the connection]
decentpenguin has joined #zig
Nypsie has joined #zig
dimenus has quit [Remote host closed the connection]
pystub has joined #zig
TheLemonMan has joined #zig
dingenskirchen has quit [Remote host closed the connection]
dingenskirchen has joined #zig
dputtick has joined #zig
decentpenguin has quit [Quit: decentpenguin]
ifreund1 has quit [Quit: WeeChat 2.8]
layneson has quit [Ping timeout: 246 seconds]
lanodan has quit [Quit: WeeChat 2.7.1]
benjif has joined #zig
Xavi92 has joined #zig
<xackus_> i was trying to fix https://github.com/ziglang/zig/issues/4907 and similar issues properly, but i don't know if i can do it without a bigger rewrite :(
<xackus_> resolve_llvm_types is just wrong and special cased to be working in common cases
ifreund has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
waleee-cl has joined #zig
klltkr_ has joined #zig
shodan45 has joined #zig
dddddd_ has joined #zig
lanodan has joined #zig
dddddd has quit [Ping timeout: 246 seconds]
dddddd__ has joined #zig
dddddd_ has quit [Ping timeout: 264 seconds]
<ifreund> hey, so i'm trying to work around the fact that zig cannot yet translate c bitfield such as the timespec struct in musl
<ifreund> i tried this but my program crashes instantly on startup https://github.com/ifreund/river/blob/musl-timespec-hack/include/timespec_hack.h
<ifreund> however, as far as I can tell from the musl code here there should be no padding on my system https://github.com/ziglang/zig/blob/15141d865abda09c09d8f6e3385f127527c5232e/lib/libc/include/x86_64-linux-musl/bits/alltypes.h#L229
<ifreund> since sizeof(time_t) == sizeof(long)
<ifreund> is there something I'm missing there? any idead for an alternative workaround?
<TheLemonMan> write a static assert to make sure that's the case
<ifreund> will do
<ifreund> TheLemonMan: so assuming i've correctly figured out how to do a static assert in C, it seems to pass https://github.com/ifreund/river/blob/musl-timespec-hack/include/timespec_hack.h
<FireFox317> uhm, the docs say that `readNoEof` returns the number of bytes read, but it doesnt. should it?
r4pr0n has joined #zig
<ifreund> alright so my hack seems to be ok with a minimal example https://paste.rs/LoI
<fengb> How did you steal Lol? :(
dddddd__ is now known as dddddd
<ifreund> fengb: L o I as in iguana actually :D
<fengb> lol
<ifreund> oh well this is interesting, maybe it's not my hack that's causing the crash https://paste.rs/M9k
marijnfs_ has joined #zig
Nypsie has quit [Quit: WeeChat 2.8]
r4pr0n has quit [Quit: r4pr0n]
r4pr0n has joined #zig
dimenus has joined #zig
pystub has quit [Ping timeout: 246 seconds]
dimenus has quit [Remote host closed the connection]
dimenus has joined #zig
r4pr0n has quit [Client Quit]
hazeycode has joined #zig
urluck has quit [Remote host closed the connection]
urluck has joined #zig
jwmerrill has quit [*.net *.split]
gazler has quit [*.net *.split]
terinjokes has quit [*.net *.split]
WilhelmVonWeiner has quit [*.net *.split]
tralamazza has quit [*.net *.split]
dottedmag has quit [*.net *.split]
pixelherodev has quit [*.net *.split]
butlerian has quit [*.net *.split]
dom96 has quit [*.net *.split]
dottedmag has joined #zig
terinjokes has joined #zig
urluck has quit [Read error: Connection reset by peer]
gazler has joined #zig
dom96 has joined #zig
urluck has joined #zig
<hazeycode> andrewrk: The crash I was having is something to specific to my code, with evented io on macOS it's easy to invoke the Cocoa event pump off the main thread, which is no good
<andrewrk> hazeycode, with the way that zig's async/await/resume/suspend works, it's possible to make a function called `switchToMainThread();` which works as advertised
FireFox317 has quit [Ping timeout: 256 seconds]
Akuli has quit [Quit: Leaving]
ur5us has joined #zig
layneson has joined #zig
Chris660 has joined #zig
pystub has joined #zig
pixelherodev has joined #zig
utzig has joined #zig
<hazeycode> I'm having some trouble with this andrewrk, I think I'm missing something, I'll try again tomorrow. I've opened a PR to enable async io on macOS, it was easier than I thought, again, I think I'm missing something
<hazeycode> It's also not really been tested at all, and I'm quite sure some of it is incorrect. But perhaps it will attract comments such that I can go and fix :)
TheLemonMan has quit [Remote host closed the connection]
puzzleddev has quit [Quit: Leaving]
pystub has quit [Ping timeout: 265 seconds]
Chris660 has quit [Ping timeout: 265 seconds]
<andrewrk> nice!
Invader_Bork has quit [Ping timeout: 260 seconds]
metaleap has quit [Quit: Leaving]
lanodan has quit [Quit: WeeChat 2.7.1]
lanodan has joined #zig
hazeycode has quit [Ping timeout: 240 seconds]
<ikskuh> andrewrk: quick question: can i somehow emit files in subdirectories in zig-build?
<ikskuh> i want to build for three platforms in a single build file
<andrewrk> yes
<andrewrk> setOutputDir works. but probably zig build should gain some recognition of multiple install directories for this use case
<ikskuh> yeah, true
<ikskuh> i'll work it out with setOutputDir for now :)
<pixelherodev> Would it be worth improving the glibc for Zig update process?
<pixelherodev> Rather, would it be possible?
ifreund has quit [Quit: Lost terminal]
dddddd has quit [Quit: dddddd]
<ikskuh> okay, seems like my emulator doesn't run well on windows yet…
<fengb> Easy solution: pipe it through wasm!
<ikskuh> heh
<ikskuh> nah, it must be fixed!
<ikskuh> but not today
<ikskuh> gn8
smari has quit [Ping timeout: 256 seconds]