ChanServ changed the topic of #zig to: zig programming language | | be excellent to each other | channel logs:
marijnfs_ has quit [Quit: WeeChat 2.6]
waleee-cl has quit [Quit: Connection closed for inactivity]
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 265 seconds]
chemist69 has quit [Ping timeout: 250 seconds]
chemist69 has joined #zig
LargeEpsilon has joined #zig
_whitelogger has joined #zig
mahmudov has quit [Remote host closed the connection]
LargeEpsilon has quit [Ping timeout: 240 seconds]
_whitelogger has joined #zig
LargeEpsilon has joined #zig
LargeEpsilon_ has joined #zig
LargeEpsilon has quit [Ping timeout: 265 seconds]
ltriant has quit [Quit: leaving]
xyproto has joined #zig
avoidr has quit [Quit: leaving]
stratact has quit [Remote host closed the connection]
mahmudov has joined #zig
neceve has joined #zig
<daurnimator> tgschultz: you could very much implement a wayland client without glibc...
stratact has joined #zig
<daurnimator> andrewrk: nrdmn: note that I've had lots of issues with a trailing VLA. e.g.
stratact has quit [Quit: Konversation terminated!]
stratact has joined #zig
squeek502 has quit [Ping timeout: 268 seconds]
scientes has quit [Ping timeout: 268 seconds]
samtebbs has joined #zig
<samtebbs> Hi all, does anyone know how to print a *u8 as a string?
<samtebbs> {} and {s} print it as u8@xxxxxx
<daurnimator> samtebbs: you'd need to dereference it.... `myu8.*`
<samtebbs> Null terminated string btw
<daurnimator> samtebbs: oh then you don't have a *u8.... you have a [*]u8
<daurnimator> samtebbs: I think you'd need to pass it as a slice: `myu8[0..mem.len(myu8)]`
<samtebbs> daurnimator: I thought I had a *u8 as I have a []*u8 and am looping over it
<daurnimator> thats a slice (runtime known array) of pointers to *characters*
<daurnimator> samtebbs: do you have a []*u8 or a [][*]u8?
<samtebbs> I'm allocating with alloc(*u8, elf_headers.num) which I assume would give me elf_headers.num u8 pointers
<samtebbs> In whatever slice/array representation
<daurnimator> samtebbs: a *u8 is a pointer to a *single* character
<samtebbs> daurnimator: Ah yes, I need []*u8 don't I
<daurnimator> samtebbs: no... you probably want a `[*]u8`
<samtebbs> Got ya, I struggle to remember the various array types and slices etc.
<samtebbs> Thanks, that works
slice has quit [Ping timeout: 240 seconds]
slice has joined #zig
samtebbs has quit [Quit: Lost terminal]
<bgiannan> gst
mahmudov has quit [Read error: Connection reset by peer]
mahmudov has joined #zig
BigEpsilon has joined #zig
LargeEpsilon_ has quit [Ping timeout: 276 seconds]
BigEpsilon has quit [Ping timeout: 268 seconds]
_Vi has quit [Ping timeout: 250 seconds]
BigEpsilon has joined #zig
halosghost has joined #zig
rifkik has joined #zig
<rifkik> Hey Everyone
<halosghost> o/
Tetralux_ has joined #zig
<rifkik> I've started work on a SNES emulator in Zig
<rifkik> It really hooked me after writing some trivial programs with it
Tetralux has quit [Ping timeout: 240 seconds]
<andrewrk> rifkik, welcome :)
<rifkik> Hey Andrew!
<andrewrk> you joined at an interesting time; 0.5.0 release is next monday
<rifkik> I'm really liking your language so far
<rifkik> really?
<rifkik> Nice
<halosghost> andrewrk: I'm quite excited :)
<fengb> ooo another emulator
<andrewrk> rifkik, meet fengb
<halosghost> lol
<rifkik> Ah, a Gameboy Emulator
<rifkik> I'm writing a SNES emulator thanks to byuu-san's kind words, He's an awesome person
<fengb> It's a tad harder for sure :P
<rifkik> Indeed
<rifkik> Definitely a step up from the NES
<rifkik> I wrote a NES emulator in go once though, so that will help
<rifkik> Sorry if this counts as advertising, I just want to see if people are interested in a ZigSNES emulator
<fengb> We're all interested in new zig projects :)
<mq32> i'll get back to embedded coding with the new release
<mq32> october will be much less events for me, so more free time for coding :)
waleee-cl has joined #zig
<andrewrk> I'm going to allocate some time in october to get my rpi bare metal arcade game up to a nice demo for handmade seattle
<andrewrk> that'll be a nice respite from bug fixing
<mq32> you mean "it will be a good alternative to find yet undiscovered bugs"? *grin*
<mq32> but yeah, sounds like a plan
_Vi has joined #zig
mahmudov has quit [Remote host closed the connection]
avoidr has joined #zig
rifkik has quit [Remote host closed the connection]
BigEpsilon has quit [Ping timeout: 245 seconds]
batok has joined #zig
LargeEpsilon has joined #zig
lucus16 has quit [Quit: lucus16]
lucus16 has joined #zig
Akuli has joined #zig
wootehfoot has joined #zig
LargeEpsilon has quit [Ping timeout: 240 seconds]
TheLemonMan has joined #zig
<TheLemonMan> andrewrk, are you able to build any test against musl? for some reason the stdio.h cannot find bits/alltypes.h
wootehfoot has quit [Quit: Leaving]
wootehfoot has joined #zig
* andrewrk checking
<andrewrk> TheLemonMan, it's working locally for me, also after 35c1d8cef we have CI test coverage for building musl on x86_64-linux-musl and aarch64v8_5a-linux-musl
<andrewrk> although the test coverage does not test `#include <stdio.h>`
<andrewrk> --verbose-cc will show the c flags
<TheLemonMan> have you tried compiling a c file too?
<andrewrk> yeah I just tried that locally
<andrewrk> in this output, `-isystem /home/andy/dev/zig/build/lib/zig/libc/include/x86_64-linux-musl` has it: ../lib/libc/include/x86_64-linux-musl/bits/alltypes.h
<andrewrk> I wonder what's different for you, the whole point of `zig cc` is to insulate against system differences
mahmudov has joined #zig
<TheLemonMan> it's armv7-linux-musleabihf that fails
<andrewrk> after this is fixed the test coverage can be enabled
<TheLemonMan> yak shaving here I come
<andrewrk> TheLemonMan, looks like we're not properly constructing the include path
<andrewrk> arm-linux-musleabihf vs arm-linux-musl
<andrewrk> this should be an easy fix
<andrewrk> codegen.cpp: detect_libc in the if (target_can_build_libc
<andrewrk> I'll be happy to take a look at this later today when I'm done with typing up release notes quota for the day
<andrewrk> TheLemonMan, out of curiosity, what's the top of your yak stack?
<TheLemonMan> upstreaming this MIPS port is my top priority right now
<andrewrk> neat
<andrewrk> going to try to get it in before the release on monday?
<andrewrk> TheLemonMan, I'll just fix this arm include thing, I got hooked once I started looking at it
neceve has quit [Ping timeout: 252 seconds]
<TheLemonMan> hah, neat. I'll try to upload a PR in the next few hours, gotta hook up the new arch in the testing harness and I'm done with it
<andrewrk> TheLemonMan, I fixed the issue but still can't enable test coverage for arm 32 because
<andrewrk> this is an issue building musl with clang 9, could probably be a nice upstream patch to send to musl
SyrupThinker has quit [Quit: WeeChat 2.5]
<andrewrk> or maybe it's an llvm issue. I'm not sure which yet
<andrewrk> anyway I pushed the include dir fix, going back to typing up release notes now
_Vi has quit [Ping timeout: 246 seconds]
TheLemonMan has quit [Read error: Connection reset by peer]
TheLemonMan has joined #zig
batok has quit [Ping timeout: 240 seconds]
SyrupThinker has joined #zig
ky0ko has quit [Remote host closed the connection]
porky11 has joined #zig
_Vi has joined #zig
ky0ko has joined #zig
redj has quit [Read error: Connection reset by peer]
redj has joined #zig
SyrupThinker has quit [Quit: WeeChat 2.6]
SimonN has joined #zig
SimonNa has quit [Ping timeout: 240 seconds]
batok has joined #zig
Akuli has quit [Quit: Leaving]
Ichorio has joined #zig
<TheLemonMan> andrewrk, I'm also fixing arm+libc stuff heh
<TheLemonMan> let's coordinate before we end up with duplicated work
<andrewrk> TheLemonMan, oh, let me throw up a PR so that we don't clobber
wootehfoot has quit [Read error: Connection reset by peer]
<andrewrk> I made it u64 instead of off_t because I think it's better unsigned, you ok with that?
<TheLemonMan> the fp errors are somewhat expected, we should emit the builtins with the aapcs calling convention
<andrewrk> ahh
<TheLemonMan> I'd blindly follow glibc on that matter and use off_t wherever they use it
<andrewrk> but why would you give a negative offset to mmap or pwrite?
<TheLemonMan> at least at the c.zig level
<TheLemonMan> -1 has a special meaning for pwrite
<andrewrk> where do you see that?
<TheLemonMan> *preadv2/pwritev2 sorry
<andrewrk> oh I see
<andrewrk> ok I agree with you
uvx has joined #zig
halosghost has quit [Quit: WeeChat 2.6]
<uvx> I have no clue how to fix this error
<uvx> any ideas?
<TheLemonMan> you have to @intCast to u6 the << RHS
<fengb> (T(1) << (nth % Size_of_T_bits)) needs to be u6 or smaller
<fengb> I mean RHS needs to be — "(nth % Size_of_T_bits)"
<fengb> Anything bigger is potential overflow and undefined behavior
<uvx> but what if I change my base type, then it will be u7 or other
<fengb> Because you're doing a mod, you might be able to get away with manual casting, @intCast(u6, blah)
<andrewrk> TheLemonMan, sounds like the next yak is re: aapcs cc
<andrewrk> but I don't think that should happen before 0.5.0
<fengb> (And it'd catch an actual overflow in debug / safe modes)
<TheLemonMan> yeah, that yak is definitely postponed to the next release
<andrewrk> I also have a research topic: ability to specify calling conventions with comptime code in userland
<andrewrk> imagine if the c calling convention or aapcs cc were fully userland concepts
<fengb> There's a builtin function to get the natural bitsize
<fengb> std function
<fengb> std.math.Log2Int(T)
<andrewrk> TheLemonMan, sorry for clobbering you, that was follow-up to nsz from #musl sending a patch
<andrewrk> OK I am way behind on my release notes quota for today
<TheLemonMan> custom CCs means you have to somehow coerce LLVM into understaning those, unless you want to do the codegen yourself but that's nuts IMO
<TheLemonMan> no problem, I had just started looking at the build failures
<mq32> andrewrk, is there a way right now to safe-convert an integer to an enum?
<mq32> @intToEnum will panic if the int is out-of-range
<uvx> fengb: thanks! it works!
<Tetralux_> mq32: meta.intToEnum IIRC
<mq32> oh right. i could just iterate over the type info
* mq32 forgets that zig is awesome :D
uvx has quit [Quit: WeeChat 1.4]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
daurnimator has quit [Ping timeout: 246 seconds]
Syrup has joined #zig
Syrup has quit [Quit: WeeChat 2.6]
uranther has joined #zig
daurnimator has joined #zig
doesntgolf has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
<_Vi> How do I project create a template (with a public function, a test and example) for Zig library intended to be used in Zig projects?
<_Vi> `zig init-lib` is for libraries resulting in libmything.a. And the template does not include a Zig example that uses the library.
<_Vi> `zig-clap` is an example of such library. But I'm not sure the how the project was generated (and if its structure is canonical).
daurnimator has quit [Ping timeout: 245 seconds]
ltriant has joined #zig
LargeEpsilon has joined #zig
porky11 has quit [Ping timeout: 250 seconds]
LargeEpsilon has quit [Ping timeout: 240 seconds]
<nrdmn> what's the current state of iterators in zig? I think there's been some work on them recently?
rifkik has joined #zig
daurnimator has joined #zig
qazo has joined #zig
nifker has joined #zig
<nifker> Oh I am finally unbanned
Ichorio has quit [Ping timeout: 245 seconds]
nifker has quit [Quit: nifker]
ky0ko has quit [Remote host closed the connection]
daurnimator has quit [Ping timeout: 264 seconds]
<mikdusan> for struct-method `foo.doit()` it is roughly sugar'd to `foo.doit(foo)` . i'd like this too if it doesn't botch the world:
<mikdusan> `` to sugar ``
<mikdusan> assuming none of intermediates `xyz` or `abc` are `@typeOf(foo)`
<mikdusan> this would really make for nice mixin components
rifkik has quit [Remote host closed the connection]
<Tetralux_> What's an example of that?
<mikdusan> you mean a use-case or just a short code example to explain what i mean?
daurnimator has joined #zig
<mikdusan> short example that doesn't work today:
<mikdusan> the obvious way today is to add param `*Foo` to barPrinter but it's actually not needed
<andrewrk> mikdusan, I'm a bit resistant to this one because the exact reason it is useful also makes reading the code more difficult
<andrewrk> Maybe I'm not understanding the proposal fully
<mikdusan> it makes the struct-method context transitive. but that in itself, yes i understand if it's not zig zen. no problemo
<Tetralux_> I can't even quite understand what that example does xD
Tetralux_ is now known as Tetralux
* mikdusan hands out the coffee
* Tetralux drinks it all in one go
<andrewrk> I have a hypothesis about these macOS ci failures. It's not easy to test though
<andrewrk> It's that they're giving us a nondeterministic amount of RAM and if we run out it does this "could not reach host" thing
<mikdusan> +1 s/hypothesis/fact/
<mikdusan> as more tests are added to zig...