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/
<g-w1> ah marler8997, I think I see what you are asking, I think it is meant to be like cmake where it just builds in your cwd. that is what people discussed in the meeting
<marler8997> g-w1, ah I see
<andrewrk> the main deciding factor was that it enables the use case of having a bunch of different build flags that you could mix and match so the user could name their own directories and do their own flag combos
craigo has quit [Ping timeout: 264 seconds]
<marler8997> gotcha, makes sense
SebastianKeller has quit [Remote host closed the connection]
bitmapper has quit [Quit: Connection closed for inactivity]
xackus has quit [Ping timeout: 265 seconds]
<mikdusan> andrewrk: forgive my nubby question; but why don't we allow errors with Builder's entry `pub fn build() !void` -- end up doing `catch unreachable` in a lot of places
wootehfoot has quit [Quit: Leaving]
tomku has quit [Ping timeout: 256 seconds]
<andrewrk> mikdusan, I think we should allow it
<andrewrk> but the reason we do catch unreachable a lot in build.zig APIs is just to make the API nicer since having the build script panic on OOM is reasonable
<daurnimator> andrewrk: I don't know about that
<daurnimator> it means that if I e.g. create a temporary directory as part of the build script.... then it might not cleaned up
tomku has joined #zig
<mikdusan> tbh I find writing with `catch unreachable` style that I end up functionalizing a lot of stuff that should just be inline blocks
<mikdusan> inline blocks with `try` where needed of course.
<mikdusan> ok thanks. was just wondering what the future might bring
<mikdusan> also there is an issue with adding C sources for frameworks and this one simple trick in build.Builder might swat a lot of grief,
<mikdusan> when an exe is told about framework dirs,
<mikdusan> it does the right thing for linking.
<mikdusan> but C sources... or C++ sources... they never learn about -F directories. So while compiling lines for C sources do not need to know about each framework like the linker does,
<mikdusan> C sources need to know about -F dirs.
<mikdusan> and we've been getting away with it for a while somehow, but good things are happening now that I'm adding -F there.
jonase has joined #zig
<andrewrk> mikdusan, in the future we will want alternate build runner modes where we collect the build configuration and do something other than execute it. so I think it would be wise to handle OOM differently, as you and daurnimator are suggesting
<andrewrk> but I think it is ok to rely on the fact that build scripts will always be run in a safe build mode (probably debug)
<andrewrk> btw I'm gonna stream in about 15 min, gonna try to build self-hosted for web assembly and make an in-browser zig playground
jonase has quit [Ping timeout: 246 seconds]
mattnite has joined #zig
<fengb> :o
mattnite has quit [Client Quit]
notzmv has quit [Remote host closed the connection]
mattnite has joined #zig
notzmv has joined #zig
notzmv has quit [Remote host closed the connection]
notzmv has joined #zig
sebonirc has quit [Quit: sebonirc]
<mikdusan> this... rabbit hole goes so deep.
notzmv has quit [Remote host closed the connection]
dddddd has quit [Remote host closed the connection]
dddddd has joined #zig
bitmapper has joined #zig
koakuma has quit [Quit: Leaving.]
nycex has quit [Ping timeout: 240 seconds]
nycex has joined #zig
keyehzy has quit [Ping timeout: 264 seconds]
dddddd has quit [Ping timeout: 256 seconds]
dddddd has joined #zig
notzmv has joined #zig
a_chou has joined #zig
a_chou has quit [Client Quit]
notzmv has quit [Remote host closed the connection]
notzmv has joined #zig
wilsonk__ has joined #zig
notzmv has quit [Remote host closed the connection]
notzmv has joined #zig
notzmv has quit [Remote host closed the connection]
sord937 has joined #zig
ky0ko has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
<andrewrk> fengb, do you know if there is a webassembly abort instruction? or a way to throw an error that stops web assembly execution
<andrewrk> ah there's a trap instruction
waleee-cl has quit [Quit: Connection closed for inactivity]
g-w1 has quit [Ping timeout: 260 seconds]
g-w1 has joined #zig
cole-h has quit [Ping timeout: 256 seconds]
FireFox317 has joined #zig
<FireFox317> andrewrk, are you online?
<andrewrk> hello
<FireFox317> morning
<FireFox317> is the TZIR that I show in #7718 actually the correct output and is it just a matter of handling that in the backend, or is actually invalid TZIR and we are missing some loads?
<FireFox317> I just need a few hints before I totally grok this :P
<andrewrk> let me check real quick
<andrewrk> FireFox317, the TZIR looks good to me
<andrewrk> I think that store you are pointing out is a dead store but it's because of the `val` result location being passed to the block. I think we will need a dead store elimination pass to get rid of such things
<andrewrk> your suggested fix does not make sense to me since the types are wrong, you can't store a *i32 into an *i32
<FireFox317> nope indeed, that solution doesnt make sense to me anymore too. I understand it better now. I actually meant that there is a load missing from %2 and then store that in %15.
<FireFox317> But in this case I think we can use a phi node to get one of the two values in the breaks
<andrewrk> nope, no load missing, it's ideal to get the value from %3. %2 is dead memory
<FireFox317> so you are also saying that for example %8 is a dead store?
<andrewrk> yes and there is a corresponding one at %12
<FireFox317> yep indeed, okay thanks. I think I can implement this in the LLVM backend :)
<andrewrk> they wouldn't have been dead if the type ended up being a struct
<FireFox317> nope indeed, its the `NodeMayNeedMemoryLocation` concept thing
<andrewrk> I don't think you need to detect the dead stores - this affects all backends so it should be solved in the frontend
<andrewrk> you can just do the allocs and stores like normal and don't worry about it
<FireFox317> yes i know :) I was referring to implementing of the phi nodes and stuff
<andrewrk> ah I see
<FireFox317> thanks for talking me through this!
<andrewrk> np!
factormystic has quit [Read error: Connection reset by peer]
factormystic has joined #zig
mattnite has quit [Remote host closed the connection]
mmx870 has quit [Ping timeout: 272 seconds]
g-w1 has quit [Ping timeout: 256 seconds]
g-w1 has joined #zig
craigo has joined #zig
jonase has joined #zig
tnorth has joined #zig
nycex has quit [Quit: Quit]
nycex has joined #zig
Nypsie[m] has quit [Quit: Idle for 30+ days]
Thalheim has quit [Ping timeout: 260 seconds]
pixelherodev has quit [Ping timeout: 264 seconds]
wootehfoot has joined #zig
g-w1 has quit [Ping timeout: 246 seconds]
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
jonase has quit [Ping timeout: 265 seconds]
utzig has left #zig [#zig]
utzig has joined #zig
ltr has joined #zig
sord937 has quit [Ping timeout: 240 seconds]
sord937 has joined #zig
jonase has joined #zig
jonase has quit [Ping timeout: 246 seconds]
stzsch has quit [Read error: Connection reset by peer]
xyproto has joined #zig
<xyproto> I recently went from "meh" to really believing that Zig has a future. But, I can't live without syntactic sugar. Are there any plans for macros/addons/preprocessors/Zig++ that can provide some sweet syntastic sugar?
quint has joined #zig
nvmd has quit [Ping timeout: 264 seconds]
<ltr> xyproto: IMO one of the points of zig is to avoid such things
ofelas has quit [Remote host closed the connection]
<xyproto> ltr: I see.
<xyproto> ltr: That also makes sense, for readability and minimalism.
utzig has quit [Quit: leaving]
<daurnimator> xyproto: no need for macros when you have comptime
ifreund has quit [Quit: WeeChat 3.0]
ifreund has joined #zig
leon-p has quit [Ping timeout: 240 seconds]
<fengb> andrewrk: opcode 00 = unreachable = trap crash
jonase has joined #zig
jonase has quit [Ping timeout: 256 seconds]
donniewest has joined #zig
waleee-cl has joined #zig
koakuma has joined #zig
<tnorth> Hi there. I'm using mmap() to store some data (f32). for that, I did cast the pointer resulting from mmap() to [*]align(std.mem.page_size)f32. This seems to work. But then to unmap() the file, I need to raw pointer back. How can I cast back?
<tnorth> (I tried several combinations but always get an error such as expected type '[]align(4096) u8', found '[*]align(4096) const u8')
<ifreund> std.os.mmap() returns a slice, which is a "fat pointer" i.e. a pointer plus a length
<ifreund> I'd recommed just storing that as it is what std.os.munmap() expects, but if you want to store the length separately for some reason you may slice your pointer when passing it to munmap
<ifreund> e.g. munmap(my_ptr[0..mapped_lenght]);
<ifreund> why do you need to mmap here instead of just allocating out of curiosity?
<tnorth> thanks I'll try that. I just started playing with Zig :)
<tnorth> @ifreund: the reason is that I plan to store a lot of data that might not fit in memory
<koakuma> Looks like the FreeBSD CI is trying to install a nonexistent package?
<tnorth> ifreund: with your solution, the result pointer is a []u8; but I want to write f32 values inside that space. How can I achieve this, since I can't cast slices?
<ifreund> tnorth: mmap gives you ram not disk
Akuli has joined #zig
<ifreund> tnorth: std.mem.bytesAsSlice
<ifreund> tnorth: really though you should just be using an allocator.
<ifreund> mmap is how allocators get memory from the system
<ifreund> if you want to write to disk you need to open a file
xackus has joined #zig
<tnorth> I open a disk file with mmap(), I expect the system to read from disk into memory as I access it and let it swap out the rest; won't that work?
<tnorth> ifreund: I'd like to have that data (array) to disk to be able to reuse it, that's why I don't pick an allocator
<tnorth> btw, bytesAsSlice() is what I needed, thanks a lot!
moo has joined #zig
wootehfoot has quit [Ping timeout: 246 seconds]
<ifreund> tnorth: indeed, memory mapping the file allows the kernel to lazily load the data from the file as you access it
<ifreund> I missed that you were mmapping a file earlier :D
moo has quit [Read error: Connection reset by peer]
jonase has joined #zig
jonase has quit [Ping timeout: 264 seconds]
leon-p has joined #zig
<tnorth> ifreund: with works very well with your suggestion, thank you again!
leon-p has quit [Client Quit]
<ifreund> no problem!
leon-p has joined #zig
nvmd has joined #zig
cCCCCcccccCCc has joined #zig
tnorth has quit [Ping timeout: 260 seconds]
notzmv has joined #zig
Stephie has quit [Ping timeout: 260 seconds]
xackus has quit [Ping timeout: 256 seconds]
jonase has joined #zig
cole-h has joined #zig
leah2 has quit [Ping timeout: 260 seconds]
sord937 has quit [Remote host closed the connection]
leah2 has joined #zig
hnOsmium0001 has joined #zig
sord937 has joined #zig
Patrice_ has joined #zig
ky0ko has joined #zig
TheLemonMan has joined #zig
<TheLemonMan> FireFox317, good job with the LLVM backend!
<FireFox317> TheLemonMan, thanks! It is surprisingly fun to work on it.
<FireFox317> probs to andrewrk, for designing the ZIR in a SSA form, because that maps really good to LLVM IR :P
<TheLemonMan> if you can afford it link against a debug build of LLVM, that'll help you spot many API mis-uses
<FireFox317> ah that's a good suggestion indeed
jonase has quit [Ping timeout: 264 seconds]
cole-h has quit [Quit: Goodbye]
cole-h has joined #zig
Stephie has joined #zig
cole-h has quit [Ping timeout: 246 seconds]
l1x has joined #zig
stzsch has joined #zig
<andrewrk> FireFox317, you could also try a release build with -DLLVM_ENABLE_ASSERTIONS=ON
<andrewrk> then you'd switch to a debug build if you hit one, to figure out more details
jonase has joined #zig
wootehfoot has joined #zig
jonase has quit [Ping timeout: 264 seconds]
ltr has quit [Quit: leaving]
sord937 has quit [Ping timeout: 240 seconds]
sord937 has joined #zig
craigo has quit [Quit: Leaving]
sebonirc has joined #zig
Akuli has quit [Quit: Leaving]
sord937 has quit [Quit: sord937]
FireFox317 has quit [Ping timeout: 240 seconds]
jonase has joined #zig
FireFox317 has joined #zig
jonase has quit [Ping timeout: 264 seconds]
donniewest has quit [Quit: WeeChat 3.0]
FireFox317 has quit [Ping timeout: 240 seconds]
l1x has quit [Quit: Connection closed for inactivity]
FireFox317 has joined #zig
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
danyspin97 has quit [Read error: Connection reset by peer]
belgin has joined #zig
danyspin97 has joined #zig
<belgin> hello
<belgin> the main page says "Zig uses undefined behavior as a razor sharp tool for both bug prevention and performance enhancement." but in the documenration it's not clear how ub can cause performance enhancement.
<CommunistWolf> same as in C, really. you can just assume certain things can't happen
<andrewrk> check out the link in the 4th bullet point just below that sentence
danyspin97 has quit [Read error: Connection reset by peer]