ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Read error: Connection reset by peer]
return0e_ has quit [Read error: Connection reset by peer]
return0e has joined #zig
<presiden> just realize that the syntac for struct is changed, in 0.3 it's struct { ... } but in master it's sturct.{ ... }
<presiden> is there a post/issue about this change?
<andrewrk> presiden, it's likely to be reverted soon. https://github.com/ziglang/zig/pull/1685
pqflx3[m] has quit [Ping timeout: 250 seconds]
tobbez has quit [Ping timeout: 252 seconds]
tobbez has joined #zig
<presiden> interesting
tolitius has joined #zig
nefreat has joined #zig
_whitelogger has joined #zig
fsateler_ has joined #zig
fsateler has quit [Read error: Connection reset by peer]
_whitelogger has joined #zig
fsateler_ has quit [Ping timeout: 250 seconds]
fsateler has joined #zig
tolitius has quit [Quit: zzz...]
tolitius has joined #zig
tolitius has quit [Client Quit]
tolitius has joined #zig
tolitius has quit [Client Quit]
tolitius has joined #zig
tolitius has quit [Client Quit]
nefreat has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fsateler has quit [Ping timeout: 240 seconds]
fsateler has joined #zig
jjido has joined #zig
jjido has quit [Ping timeout: 245 seconds]
jjido has joined #zig
hryx has joined #zig
jjido has quit [Ping timeout: 260 seconds]
_whitelogger has joined #zig
jjido has joined #zig
very-mediocre has joined #zig
davr0s has joined #zig
jjido has quit [Ping timeout: 246 seconds]
wink_ has quit [K-Lined]
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
davr0s has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jjido has joined #zig
davr0s has joined #zig
steveno has joined #zig
jjido has quit [Read error: Connection reset by peer]
jjido has joined #zig
tolitius has joined #zig
nefreat has joined #zig
jreut has quit [Read error: Connection reset by peer]
<nefreat> i just built 0.3.0 (on a macos mojave) when running build.zig test, I get the following:
<nefreat> anyone know how to fix it?
<nefreat> Assertion failed: (type_is_resolved(type_entry, ResolveStatusAlignmentKnown)), function get_abi_alignment
<andrewrk> nefreat, why run tests from anything but master branch?
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<andrewrk> we have pre-made builds of 0.3.0 for all supported platforms, no need to test them (they don't even ship with all the tests)
<andrewrk> otherwise if you want to help develop zig, great - you want master branch
<nefreat> andrewrk, thanks, I'll try master
DutchGh0st has joined #zig
<DutchGh0st> why cant I call ` pub fn inStream(file: File) InStream {` on a stdin handle?
<andrewrk> DutchGh0st, seems like that should work to me
<andrewrk> what behavior are you seeing?
<DutchGh0st> `: no member named 'inStream' in struct 'File'`
daurnimator has quit [Ping timeout: 252 seconds]
<DutchGh0st> I am using Windows, maybe that is it?
<DutchGh0st> altough os.File doesnt care about platform per se,
<andrewrk> DutchGh0st, it works on master branch for both linux and windows. I'm guessing you're using an older version of zig which had a different std lib API
<DutchGh0st> 0.3.0
daurnimator has joined #zig
<DutchGh0st> so what would be the idiomatic way to read in some integers from stdin?
<DutchGh0st> thats all I want to do
DutchGh0st has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
m4ge123 has quit [Read error: Connection reset by peer]
m4ge123 has joined #zig
davr0s has joined #zig
DutchGh0st has joined #zig
jjido has quit [Ping timeout: 246 seconds]
<DutchGh0st> is there a function to parse a []const u8 to an integer type?
<DutchGh0st> in stdlib?
jjido has joined #zig
<andrewrk> DutchGh0st, when you say read some integers, you mean like for a programming coding challenge?
very-mediocre has quit [Ping timeout: 256 seconds]
<DutchGh0st> well, we had to do some homework assignment in Python
<DutchGh0st> but that was boring
<DutchGh0st> and I just wanted to do it in Zig ^^
<andrewrk> does it have to be streaming, or can you read all the stdin into a buffer?
<DutchGh0st> here's the thing, first a message needs to be printed,
<DutchGh0st> then you read 1 number from stdin,
<DutchGh0st> then another msg is printed,
<DutchGh0st> then read another number,
<DutchGh0st> and that combination of print, read is done like 8 times
<DutchGh0st> isn't there a function like io.readline, but that takes already acquired stdin handle?
<andrewrk> DutchGh0st, that's a good point, there should be one
<andrewrk> and then std.io.readLine should call it
<DutchGh0st> I dont know how expensive it is to acquire stdin, but I feel like calling io.readline over and over again has more overhead than needed
<DutchGh0st> and maybe there's also an io.writeLine currently? perhaps a similar function should be added as well
<DutchGh0st> I can make a proposal right now, and see what everyone thinks of it? :)
jjido has quit [Ping timeout: 252 seconds]
jjido has joined #zig
jjido has quit [Ping timeout: 250 seconds]
<andrewrk> I don't think we need io.writeLine. the normal stream API should suffice
<andrewrk> readLine exists because it makes sense to do when treating stdin as a "terminal ui" sort of thing
<andrewrk> e.g. it would make sense for it to use escape codes and such
<jfondren> how can I avoid the struct initialization here? https://gist.github.com/jrfondren/cd396d2c156e46d4ac4d73ea55a067e8 I just want to stack-allocate however much the struct needs (especially without caring about stuff like __reserved) and then let the function initialize it
<andrewrk> jfondren, var usage: c.struct_rusage = undefined;
<andrewrk> are you trying to produce a linux binary or a macos binary?
<andrewrk> on macos, applications always link libSystem (which is libc) because that's the stable syscall ABI
<andrewrk> I don't think it would make sense to use musl
<jfondren> I'm not actually using musl. Just using its header, since zig can't find sys/resource.h otherwise
<andrewrk> where is sys/resource.h on your system?
<nbjoerg> the fun of modern glibc deployments where they vomit headers in random places?
<jfondren> = undefined does work... I must've tried that only when there were other problems, and never tried it again.
<jfondren> macOS Mojave has a bunch of sys/resource.h files under different X.platform dirctores under /Applications/Xcode.app
<andrewrk> is that 10.14?
<jfondren> so, probably the technically correct one is /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/resource.h
<andrewrk> what we need to figure out is, how does the native system compiler know to look there
<jfondren> 10.14 aye
<andrewrk> on linux we do: `cc -E -x c - -v` and that gives us the include dir
<andrewrk> on macos it doesn't work
<nbjoerg> it doesn't?
<andrewrk> looks like I can upgrade my laptop from 10.13.6 -> 10.14.1
<andrewrk> I'll try it
<andrewrk> jfondren, you could also send a patch to the std lib that adds getrusage extern declaration in std/c/darwin.zig (or if it's a posix api, in the main file)
<andrewrk> and then while waiting for the patch to be merged, just have the extern declaration local to your project
<andrewrk> a good start would be `zig translate-c /path/to/sys/resource.h` and then clean up the pointer types and add "c" to the `extern` decls
<andrewrk> this would remove a dependency on /usr/local/Cellar/musl-cross/* in your project
<jfondren> it's a POSIX API. Although I notice that the units change across OSes (RSS is in bytes, not kB, on macOS)
<jfondren> sure, I'll take a look at that
<andrewrk> jfondren, one more thing, looks like you're making a CLI app whose purpose is to output information right? so you probably want to output to stdout rather than using std.debug.warn
<andrewrk> you can still have the print interface: https://gist.github.com/Hejsil/141d1433a64a3495636453860cee3abd
<jfondren> stderr works here. it's a little benchmarking app, a port of https://github.com/jrfondren/getr
<jfondren> 'run a thing a bunch of times, then get RUSAGE_CHILDREN'. so stdout from the thing you're running might be piped to null
<jfondren> although it's obviously an option to spawn the child with /dev/null for its stdout. room for improvement.
DutchGh0st has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
jfo has joined #zig
<andrewrk> jfondren, I updated to 10.14.1 and I observe that /usr/include is missing. I'll look into updating zig to work on this version of macos
<andrewrk> if I run `cc` that doesn't even work. I see xcrun: error: invalid active developer path
steveno has quit [Remote host closed the connection]
<jfondren> I had to reinstall XCode after the upgrade, and got that same error
<andrewrk> pure zig doesn't need xcode command line tools to work on macos, but it does if you want @cImport to work
<andrewrk> `xcode-select --install` seems to be working
<jfondren> cool
<andrewrk> `cc -E -x c - -v` works after installing command line tools. so we can enable the same thing we use on linux, on macos
jfo has quit [Ping timeout: 252 seconds]
<andrewrk> this works on my mojove laptop, just need to make sure it works on 10.13 which the CI server is running
nefreat has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tolitius has quit [Quit: zzz...]
desttinghim has quit [Ping timeout: 245 seconds]