ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
_whitelogger has joined #zig
Ichorio_ has quit [Ping timeout: 245 seconds]
schme245 has quit [Remote host closed the connection]
radgeRayden has quit [Ping timeout: 244 seconds]
steveno has quit [Quit: Leaving]
Avila has quit [Quit: Leaving]
<kristate> MajorLag: andrewrk: I can rebase #1851, if that helps
<kristate> andrewrk: btw, can we get a hint about how the values in `hash_const_val` are calculated ?
kristate has quit [Remote host closed the connection]
kristate has joined #zig
fsateler has quit [Read error: Connection reset by peer]
fsateler has joined #zig
noonien has quit [Quit: Connection closed for inactivity]
_whitelogger has joined #zig
<andrewrk> kristate, literally random. I'm sure the hashing in zig compiler is poor quality and could be improved with minimal effort
<kristate> andrewrk: hey, ok
<kristate> andrewrk: in some places we are adding to the base magic number
<andrewrk> yeah it's not even consistent
<andrewrk> the hash function could return 0 for all cases and everything would still work, it's just a heuristic
<kristate> andrewrk: understood, okay.
<andrewrk> but if the hash is quick to calculate and reasonably distributes values, then it will speed up hash table lookups
<daurnimator> andrewrk: can probably be made much better in stage2 :)
<daurnimator> because we can have compile time perfect hashing
<andrewrk> that's only if you know all the inputs at compile time
Thalheim has quit [Ping timeout: 246 seconds]
darithorn has quit [Remote host closed the connection]
redj has quit [Read error: Connection reset by peer]
jevinskie has joined #zig
nelarius has joined #zig
nelarius has quit [Client Quit]
_whitelogger has joined #zig
schme245 has joined #zig
jevinskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jevinskie has joined #zig
Marumoto has joined #zig
Marumoto has quit [Ping timeout: 244 seconds]
jevinski_ has joined #zig
jevinskie has quit [Ping timeout: 240 seconds]
jevinski_ has quit [Read error: Connection reset by peer]
jevinskie has joined #zig
schme245 has quit [Remote host closed the connection]
Zaab1t has joined #zig
schme245 has joined #zig
schme245 has quit [Remote host closed the connection]
return0e has quit [Ping timeout: 245 seconds]
return0e has joined #zig
Ichorio has joined #zig
jevinskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<kristate> live streaming with jimmi: https://www.twitch.tv/findyourownpath
steveno has joined #zig
steveno has quit [Remote host closed the connection]
wootehfoot has joined #zig
MajorLag has quit [Ping timeout: 240 seconds]
MajorLag has joined #zig
Zaabtop has joined #zig
Zaab1t has quit [Ping timeout: 250 seconds]
Zaabtop is now known as Zaab1t
schme245 has joined #zig
<kristate> FYI, GEP into vectors is not recommended! https://www.llvm.org/docs/GetElementPtr.html#can-gep-index-into-vector-elements
noonien has joined #zig
schme245 has quit [Remote host closed the connection]
fsateler has quit [Read error: Connection reset by peer]
fsateler has joined #zig
schme245 has joined #zig
Zaab1t has quit [Read error: Connection reset by peer]
Zaab1t has joined #zig
darithorn has joined #zig
Marumoto has joined #zig
<Marumoto> It seems like this issue https://github.com/ziglang/zig/issues/1715 is fixed now?
Zaab1t has quit [Quit: bye bye friends]
forgot-password has joined #zig
<andrewrk> kristate, it's planned for zig to never emit a getelementptr instruction for vectors
<andrewrk> that's the " compile error for trying to get a pointer to a vector element" checkbox
<andrewrk> note that vectors of pointers is a different concept
<andrewrk> and getelementptr on a vector of pointers is 100% ok, that's the same thing as addition on vectors of integers
<andrewrk> Marumoto, good to know. Once we have a new test in place to cover it, we can close the issue
forgot-password has quit [Ping timeout: 252 seconds]
forgot-password has joined #zig
forgot-password has quit [Client Quit]
Akuli has joined #zig
steveno has joined #zig
steveno has quit [Remote host closed the connection]
<Akuli> i want to use a function that uses an Allocator, so how can i create an Allocator?
<Akuli> i'm looking at std/mem.zig and thinking of something like const the_allocator = std.mem.Allocator { .allocFn = somethingLikeMalloc, .reallocFn = somethingLikeRealloc, .freeFn = somethingLikeFree }; but there's probably a better way than doing this all myself?
<Akuli> neeeeeeeevermind... i found std.heap.c_allocator
darithorn has quit [Remote host closed the connection]
darithorn has joined #zig
wootehfoot has quit [Read error: Connection reset by peer]
<Akuli> how do i print a formatted message to stderr? i tried (try std.io.getStdErr()).outStream().stream and then try stderr.print("Usage: {} arg\n", program_name); but i get a weird EBADF error
<darithorn> Akuli: use std.debug.warn
<Akuli> is that still good if i don't want to debug my program, but i want to write a usage message?
<andrewrk> Akuli, it's good if you want to ignore potential errors from writing to stderr
<darithorn> I imagine it'd be just fine. It has debug in the name but it's just a wrapper for writing to stderr.
<andrewrk> if stderr is important to the correctness of your application then I recommend using std.io.getStdErr()
<emekankurumeh[m]> are closures planned for zig?
<Akuli> thanks, i think i'll use std.debug.warn
<Akuli> how should i debug memory leaks? i tried valgrind but it's not very informative
<andrewrk> Akuli, that's https://github.com/ziglang/zig/issues/896. it's actually a valgrind bug. we have a workaround:
<andrewrk> --no-rosegment compromise security to workaround valgrind bug
<Akuli> ooooo nice! i like this, valgrind works very well now
<andrewrk> it's also planned to have a debug allocator in the standard library to do leak checking and other useful stuff
<andrewrk> emekankurumeh[m], https://github.com/ziglang/zig/issues/229
<andrewrk> it's not planned to have hidden memory allocations
<andrewrk> but you can right now create a function inside an anonymous struct inside a function
<Akuli> zig seems like an awesome language so far, i like everything i see
<Akuli> i wish i was able to learn it faster
<andrewrk> also, after the coroutine rewrite, coroutines will serve a similar purpose to closures
<andrewrk> I wish I was able to develop it faster
<emekankurumeh[m]> i was just about to ask about that :)
<emekankurumeh[m]> you're only one person though.
<emekankurumeh[m]> would that debug allocator wrap around another allocator or would it be a standalone allocator?
<andrewrk> emekankurumeh[m], that's a good question, not sure yet
<Akuli> an old zig blog post explains how %defer worked, what is it called nowadays? %defer gives me a syntax error
<andrewrk> errdefer
<andrewrk> which post is that?
<Akuli> neat thanks
<emekankurumeh[m]> i was thinking on porting rpmalloc to zig, so we could have a general purpose allocator in std for 0.4.0
<andrewrk> neat
<andrewrk> is that a good one?
<andrewrk> I have not heard of rpmalloc
<emekankurumeh[m]> from the benchmarks shown it looks pretty good.
<emekankurumeh[m]> it's public domain too
<andrewrk> cool
<andrewrk> should work fine, if the API user requests more than 32 byte alignment, you can return error.OutOfMemory
kristate has quit [Remote host closed the connection]
<schme245> "i wish i was able to learn it faster", haha, I hear you on that one
<andrewrk> Akuli, wow some of this info is very out of date. I'm updating the post
<andrewrk> especially with regards to errors
<Akuli> awesome :D
<Akuli> how do i free the memory that std.os.args().next(allocator) returns? allocator.free(value)?
<andrewrk> yes
<Akuli> nice
<andrewrk> you might also consider std.os.argsAlloc
<andrewrk> that will give you a slice of slices which is pretty convenient, and then you can free it all at once with std.os.argsFree
<andrewrk> btw blame windows for why we have to allocate memory to parse command line arguments
<Akuli> yes, i had posixNext() before
<emekankurumeh[m]> some things on macos can only be done in objc right?
<Akuli> how do i return status 1 to the os so that defers in main() run? std.os.exit(1) in main() doesn't work
<Akuli> it exits the process, but leaks some memory because i have defer stuff_that_frees()
<Akuli> well, i created an intMain() function that works like c's main() and put everything into it, defers run correctly now
darithorn has quit [Quit: Leaving]
<Akuli> i'll be back
Akuli has quit [Quit: Leaving]
darithorn has joined #zig
wootehfoot has joined #zig
<andrewrk> Akuli, you can make the return type of main be u8