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/
<marler8997__> this looks very useful for you x86 zig backenders: https://hvmi.github.io/blog/2020/11/04/bddisasm.html
squeek502 has joined #zig
Kena has joined #zig
<Kena> Please what can I do to make this work? error: incompatible types: 'std.builtin.TypeInfo' and 'type'
<Kena> test "compile-time reflection on a string literal dereferencing" { comptime expect(@typeInfo(@TypeOf("hello".*)) == [5:0]u8);}
<ifreund> you don't need the @typeInfo() call there
<ifreund> just do @TypeOf("hello".*) == [5:0]u8
<Kena> You're right, thank you :)
maxrazer has quit [Quit: Leaving]
kristoff_it1 has quit [Ping timeout: 240 seconds]
frmdstryr has quit [Ping timeout: 256 seconds]
a92 has joined #zig
Kena has quit [Remote host closed the connection]
squeek502 has quit [Remote host closed the connection]
x2C25 has quit [Ping timeout: 258 seconds]
foobles has joined #zig
<g-w1> when i try to pass void to a function, it says expected type void found type. is there a void literal that is a value?
<fengb> {} is a void value
<g-w1> thanks
<foobles> in `ir_analyze_bin_op_cmp`, it emits `IrInstGenBinOp` with potentially `*T` values, which are then compared. However, in `ir_render_bin_op`, only numeric types and some others are allowed to be compared. I added some logging and saw that once the IrInstGenBinOp got to the `ir_render_bin_op` function, the input types had been changed to `u64`
<foobles> instead of pointers
<foobles> where is this transformation done?
<foobles> I think there is a bug in that section of the code base surrounding optional zero-size pointers
<foobles> edit: nevermind, it doesnt do transformations. i misread the case switch in ir_render_bin_op
ur5us has quit [Ping timeout: 264 seconds]
a92 has quit [Quit: My presence will now cease]
ur5us has joined #zig
xackus has quit [Ping timeout: 256 seconds]
<pjz> what's the best/standard way to organize 3rd party zig library imports?
<pjz> eg. I want to use https://github.com/truemedian/wz ; do I... add it as a git module and set up my build to depend on its build somehow? just say 'mything depends on wz' and have build/install wz be a user/developer-required action? something else?
<daurnimator> pjz: for now people have been using git submodules
<pjz> daurnimator: thanks. I'll do that, then.
<pjz> daurnimator: any hints/pointers on how to teach build.zig about my new submodule dependency?
<daurnimator> `addPackage`
<daurnimator> there isn't really an API defined yet to know what dependencies it wants; so you'll have to look by hand
<foobles> in LLVM, how do you cast an int to a i1 as if it were a bool?
<foobles> like if you have 1234 as an i32, how do you convert that to a 1 i1
<foobles> like doing `(bool)1234` in C++
<pjz> oh, so I have to add my dependency via addPackage, but also its dependencies? IWBNI I could add a dependency on my dependencie's build.zig and have it able to figure out what it needs from there.
earnestly has quit [Ping timeout: 240 seconds]
<pjz> the Builder has the info, I think.
x2C25 has joined #zig
gazler has quit [Ping timeout: 256 seconds]
blueberrypie has quit [Quit: leaving]
gazler has joined #zig
blueberrypie has joined #zig
dumenci has joined #zig
ur5us has quit [Ping timeout: 264 seconds]
<pjz> ah, I see there's plans for that
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
GrooveStomp has quit [Ping timeout: 256 seconds]
osa1 has joined #zig
wilsonk_ has quit [Quit: Leaving]
dumenci has quit [Ping timeout: 272 seconds]
austinbox has joined #zig
mmohammadi9812 has quit [Ping timeout: 258 seconds]
austinbox has quit [Ping timeout: 245 seconds]
lucid_0x80 has joined #zig
frett27 has joined #zig
dumenci has joined #zig
lucid_0x80 has quit [Ping timeout: 264 seconds]
stripedpajamas has joined #zig
decentpenguin has quit [Read error: Connection reset by peer]
decentpenguin has joined #zig
mmohammadi9812 has joined #zig
mmohammadi9812 has quit [Read error: Connection reset by peer]
gazler_ has joined #zig
gazler has quit [Ping timeout: 265 seconds]
frett27 has quit [Ping timeout: 256 seconds]
cole-h has quit [Ping timeout: 240 seconds]
ur5us has joined #zig
stripedpajamas has quit [Quit: sleeping...]
lucid_0x80 has joined #zig
Kuraitou has quit [Ping timeout: 265 seconds]
Kuraitou has joined #zig
dumenci has quit [Ping timeout: 256 seconds]
skuzzymiglet has joined #zig
ask6155 is now known as help
help is now known as Guest91746
x2C25 has quit [Ping timeout: 258 seconds]
omglasers2 has joined #zig
mmohammadi9812 has joined #zig
mmohammadi9812 has quit [Client Quit]
kristoff_it1 has joined #zig
ur5us has quit [Ping timeout: 264 seconds]
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
earnestly has joined #zig
mmohammadi9812 has joined #zig
Kingsquee has quit [Ping timeout: 244 seconds]
xackus has joined #zig
PC980172 has joined #zig
PC98017 has quit [Read error: Connection reset by peer]
PC980172 is now known as PC98017
PC98017 has quit [Read error: Connection reset by peer]
PC98017 has joined #zig
PC980179 has joined #zig
PC98017 has quit [Ping timeout: 256 seconds]
PC980179 is now known as PC98017
Kingsquee has joined #zig
foobles has quit [Remote host closed the connection]
FireFox317 has joined #zig
decentpenguin has quit [Ping timeout: 272 seconds]
PC980177 has joined #zig
PC98017 has quit [Ping timeout: 260 seconds]
PC980177 is now known as PC98017
Kena has joined #zig
decentpenguin has joined #zig
<Kena> Hello, in the following doc example: const c = @cImport({ // See https://github.com/ziglang/zig/issues/515 @cDefine("_NO_CRT_STDIO_INLINE", "1"); @cInclude("stdio.h");
<Kena> Is the argument's type of `@cImport()` a tuple?
<ifreund> no, it's a block
<ifreund> pretty sure you can do const c = @cImport(@cInclude("foo.h")); if you only have one thing
<alexnask[m]> Yes
<ifreund> to be more accurate, @cImport() takes an expression then
<Kena> Allright, thank you again :)
_whitelogger has joined #zig
teleton has joined #zig
_whitelogger has joined #zig
swills has joined #zig
swills has quit [Ping timeout: 265 seconds]
swills has joined #zig
<Kena> I have another question regarding the call to `@cImport();`. It raises the following at compilation time: .\cimport.zig:1:11: error: C import failedconst c = @cImport({ ^.\cimport.zig:1:11: note: libc headers not available; compilation does not link against libcconst c = @cImport({
swills has quit [Ping timeout: 256 seconds]
<Kena> Do you know how to fix it? I'm currently using Windows 10.
<alexnask[m]> Are you using a build.zig script or zig build-exe?
<Kena> zig build-exe
<ifreund> -lc
<g-w1> Can heap allocated variables just dissapear?
<ifreund> no?
<ifreund> i mean you can free them accidentally I suppose
<g-w1> ok, then ill send a pic of whats going on. its weird
<ifreund> but computers do exactly what you tell them do do barring hardware failure
<Kena> I think build.zig has not been created yet as I never ran `zig init-exe` or `zig init-lib` .
<Kena> zig build-exe cimport.zig -lcerror: unable to create compilation: WindowsSdkNotFound
<alexnask[m]> Do you have msvc/build tools installed? If not, also add -target native-native-gnu
<Kena> I have not. I'll try your flag immediatly.
<alexnask[m]> (This is planned to change by 0.7.0 to be the default)
<g-w1> I am working on zigup and trying to impliment command to clean compilers, but my default compiler variable is dissapearing, I think it may be freeing too early, but idk. https://i.imgur.com/Hv5i3lA.png
<Kena> `zig build-exe cimport.zig -target native-native-gnu` raises again `error: C import failed` `note: libc headers not available; compilation does not link against libc`
<alexnask[m]> Keep -lc as well ;)
<g-w1> do you see anything that is freeing default_comp_opt? This looks like an allocator issue to me.
<Kena> Compiling C objects is in progress, thanks! But what does `-lc` stands for?
<g-w1> link libc
<Kena> Allright :)
<ifreund> -lfoo links foo
mmohammadi9812 has quit [Ping timeout: 272 seconds]
<ifreund> g-w1: do yo have the full code pushed somewhere? hard to get much from what I can see in the screenshot
<g-w1> ill put in pastebin, its only one file
<FireFox317> Kena, c assumes that libc is always linked when using c itself, with zig we don't depend on libc be default. (Thus when using c libraries you have to link libc `-lc`)
swills has joined #zig
<g-w1> ifreund, its in cleanCompilers function
frmdstryr has joined #zig
<ifreund> g-w1: yep, the bug is in getDefaultCompiler
<ifreund> basename() doesn't allocate it slices
<ifreund> so you're returnig a slice of stack memory
<ifreund> calling the function between your print statements overwrites this stack memory
<g-w1> ah, and then it gets overwritten. thanks
<Kena> FireFox317 is the default one Musl? no system library at all?
<ifreund> no libc at all
<ifreund> well, at least on systems where that is ok like linux
<ifreund> on some OSes libc is the only stable interface to the kernel
<Kena> Understood, I thought musl was a good candidate to be defaulted as Andrew was sponsoring his maintainer.
<alexnask[m]> A substantial poriton of the zig standard library is a musl port
<ifreund> yeah musl's source code is a very valueable resource
<ifreund> it's actually readable unlike glibc
<g-w1> is there a way to allocate to a *[4096]u8 instead of []u8?
<FireFox317> However, Kena, musl is only something for linux, on windows we have mingw-w64 which is thing similar to musl but then for windows.
<FireFox317> someone please correct me if i'm wrong ^^
<alexnask[m]> g-w1: allocator.create([4096]u8)
<g-w1> ah, thanks
<alexnask[m]> (and your free becomes a destroy)
<ifreund> is mingw-w64 really comparable to musl in terms of it's goals of simplicity?
mmohammadi9812 has joined #zig
<FireFox317> ifreund, well maybe not in terms of simplicity, but regarding making cross compilation work it is?
<alexnask[m]> Well, its a libc so its similar in that sense :P
<alexnask[m]> Havent looked at the source code though tbh, I wouldnt expect it to be clean and simple
<ifreund> the point of mingw-w64 seems to just be to get gcc working on windows
marnix has quit [Ping timeout: 265 seconds]
marnix has joined #zig
lucid_0x80 has quit [Ping timeout: 265 seconds]
swills has quit [Ping timeout: 240 seconds]
Kena has quit [Remote host closed the connection]
FireFox317 has quit [Quit: Leaving]
skuzzymiglet has quit [Ping timeout: 240 seconds]
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
waffle_ethics has joined #zig
frmdstryr has quit [Ping timeout: 256 seconds]
frmdstryr has joined #zig
swills has joined #zig
waffle_ethics has quit [Ping timeout: 256 seconds]
waffle_ethics has joined #zig
swills has quit [Ping timeout: 272 seconds]
skuzzymiglet has joined #zig
swills has joined #zig
swills has quit [Ping timeout: 260 seconds]
mudk1p has joined #zig
mudk1p has quit [Remote host closed the connection]
brentp has joined #zig
_foobles has joined #zig
waffle_ethics has quit [Ping timeout: 256 seconds]
<_foobles> if I have an IrInstGen representing a bool, but I want to convert that to an IrInstGen of i1 or ?*void, how do you do that?
xackus has quit [Ping timeout: 258 seconds]
waffle_ethics has joined #zig
<brentp> hi all, with this code: https://pastebin.com/PbSmTegM
<brentp> i get this error: https://pastebin.com/raw/zKsQ4C9A
<g-w1> it is an optional but you are trying to dereference. if your sure it is not null, do if (!(htsfp.?.*
<brentp> that is autogenerated from the C bindings. might be related to: https://github.com/ziglang/zig/issues/1580 but not sure.
<brentp> I don't deref. it's generated code
<g-w1> oh
lucid_0x80 has joined #zig
tane has joined #zig
swills has joined #zig
donniewest has joined #zig
teleton has quit [Quit: Leaving]
skuzzymiglet has quit [Ping timeout: 272 seconds]
n1tram has joined #zig
jjsullivan1 has joined #zig
marnix has quit [Ping timeout: 240 seconds]
marnix has joined #zig
mmohammadi9812 has quit [Ping timeout: 258 seconds]
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
marnix has quit [Ping timeout: 240 seconds]
marnix has joined #zig
mmohammadi9812 has joined #zig
companion_cube has quit [Quit: WeeChat 2.9]
companion_cube has joined #zig
nvmd has joined #zig
jmiven has quit [Quit: brb]
jmiven has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
Guest91746 is now known as ask6155
hnOsmium0001 has joined #zig
<g-w1> does making a function inline mean that it doesn't have it's own stack frame and it can return stack allocated memory?
<brentp> is there a better or preferred place to ask zig questions like mine above?
<g-w1> Probably on github issues. it seems like a compiler problem.
<ifreund> brentp: that seems like a separate issue from #1580, I'd open a new one
<ifreund> g-w1: no, that's still UB afaik
<ifreund> even if it "works" it's a massive foot gun to make that part of your api
drazan has quit [Remote host closed the connection]
<fengb> Stack is block based so no it’s still not safe
<g-w1> oh. What is the best way to do this. This is where I would use a macro in a language like rust. I am just trying to factor out common parts out of my code without allocating
<g-w1> it seems like my problem is that I create a buffer and return a slice to it. would returning the buffer + slice, like in a tuple work better?
drazan has joined #zig
<ifreund> take the buffer as a parameter?
<g-w1> ah, thanks!
<ifreund> or return an array by value if the size is comptime known
<g-w1> the buffer paramater works
<g-w1> it would be nice if in the function definition you could tell the compiler to allocate a return slot
<g-w1> thats what i was trying to do
skuzzymiglet has joined #zig
<ifreund> you see to be talking about result location semantics
<g-w1> yeah
<ifreund> zig already kinda does this
<g-w1> it allows to return arrays ig, but not slices
<ifreund> the feature need more development though
<fengb> Zig cannot allocate variable size types
<g-w1> ok. thanks
<fengb> On the stack
<ifreund> yeah this is for returning values only
<fengb> You can safely return arrays. Not slices or pointers to stack memory
<g-w1> yeah. i was saying that it would be nice if the compiler could tell when you were returning a slice to stack allocated memory and also return the slice with it, but passing a buffer works fine
<g-w1> and also return the *memory with it
<fengb> That requires ownership and/or ref counting
<g-w1> yeah, more in rust's territory. im just not used to manual memory management, but ill learn :)
<ifreund> garbage collection does make things easier, but then your code runs slow
<fengb> I use this to return “dynamic” arrays: https://github.com/fengb/zigbot9001/blob/master/src/main.zig#L39
frmdstryr has quit [Ping timeout: 240 seconds]
marnix has quit [Read error: Connection reset by peer]
Barabas has joined #zig
marnix has joined #zig
<Barabas> I'm trying to build master, but it fails with `allocation failed` when trying to build zig1.obj
frmdstryr has joined #zig
<Barabas> I have 14GB free atm and it doesn't seem to get close, so I'm wondering how much it's trying to allocate :-/
_foobles has quit [Ping timeout: 245 seconds]
<Barabas> I mean, it goes up to use 4GB (so 9 still free) and then fails, so it must be trying to allocate a shitton at once or something.
<Barabas> Weird, I freed up some more and now it's running at a stable ~5.5GB. :/
marnix has quit [Read error: Connection reset by peer]
n1tram has quit [Remote host closed the connection]
marnix has joined #zig
cole-h has joined #zig
frmdstryr has quit [Ping timeout: 260 seconds]
brentp has quit [Remote host closed the connection]
lucid_0x80 has quit [Remote host closed the connection]
lucid_0x80 has joined #zig
skuzzymiglet has quit [Ping timeout: 260 seconds]
waffle_ethics has quit [Ping timeout: 264 seconds]
earl has joined #zig
Techcable has quit [Quit: ZNC - http://znc.in]
<earl> hey everyone. i'm trying to cross-compile a minimal example as lib from x86_64 linux (host) to i386 linux (target)
<earl> my example is simply: `export fn add(a: i32, b: i32) i32 {return a + b;}`
Techcable has joined #zig
<earl> which i'm trying to build using `zig build-lib -dynamic -target i386-linux-gnu --library c --single-threaded test.zig`
<earl> but i'm getting the following error:
<earl> Build Dependencies...lld: error: relocation R_386_PC32 cannot be used against symbol __zig_probe_stack; recompile with -fPIC
<earl> same error when i add -fPIC to the build-lib call
<earl> any ideas?
foobles has joined #zig
<g-w1> maybe ld wants you to pass -fPIC as a linker arg
<g-w1> because it seems like a linker message, not zig
<earl> good point, thanks. let me see if i can find out how to pass args to the linker via zig's cli
waffle_ethics has joined #zig
<g-w1> i dont see one, so maybe zig build-obj and then try to link manually with the standard library.
<g-w1> time to study for test next period
<g-w1> sorry
<g-w1> wrong chat
<g-w1> :|
<earl> me neither. tried calling lld directly (with the command from --verbose-link), and it doesn't accept -fPIC
<g-w1> interestingly building a static lib works
dumenci has joined #zig
<alexnask[m]> This probably broke when switching to the new CLI
lucid_0x80 has quit [Ping timeout: 260 seconds]
<alexnask[m]> Ah nvm, seems like its an older bug (https://github.com/ziglang/zig/issues/3852)
<earl> ah, thanks for digging this out.
Kena has joined #zig
<earl> however, as the wrong relocation is in __zig_probe_stack, that's possibly something related but different
<earl> and indeed, adding `-fno-stack-check` fixes my immediate problem
frett27 has joined #zig
<alexnask[m]> Ah, good point, I thought it was still a compiler-rt symbol but it wasnt, read too hastily
<Kena> I have another noobie question. When it is said in the doc "When constant is used as a pointer attribute, it denotes that the value referenced by the pointer can not be modified". Please does it mean that the memory address pointed by the pointer is constant or is the value stored in the memory address pointed to by the pointer is constant?
<ifreund> the value stored
<ifreund> var foo: *const u8 vs const foo: *u8
<ifreund> in the first the memory address is variable and the value stored there constant
<ifreund> in the second the opposite is true
waffle_ethics has quit [Ping timeout: 244 seconds]
waffle_ethics has joined #zig
lucid_0x80 has joined #zig
<Kena> Thanks again ifreund, I admit the pointer mechanisms are a tough pill to swallow. I have no co-workers, no teacher nor friends to ask anything related to programming, so if an online resource or a book is to obscure to deliver any understanble knowledge, I must ask for help otherwise I won't be able to become a programmer
<Kena> Thanks for your support.
frmdstryr has joined #zig
dumenci has quit [Ping timeout: 260 seconds]
<ifreund> no worries, I've been lucky enough to have a solid education and am usually happy to help out anyone learning zig :)
<foobles> Kena the referent of the pointer cannot be changed by that pointer
<foobles> oh wait
<foobles> i was scrolled up oops :P
x2C25 has joined #zig
skuzzymiglet has joined #zig
<foobles> heyo, anyone know how to convert an IrInstGen with value type `bool` and I need to convert that to an IrInstGen with type `?*void`
<foobles> i know that internally an optional zero-size type is represented as an `i1
Ashpool has joined #zig
osa1 has quit [Quit: osa1]
earl has left #zig [#zig]
earl has joined #zig
waffle_ethics has quit [Quit: Lost terminal]
nvmd has quit [Ping timeout: 258 seconds]
nvmd has joined #zig
Kena has quit [Remote host closed the connection]
PC98017 has quit [Quit: The Lounge - https://thelounge.chat]
PC980177 has joined #zig
ur5us has joined #zig
nvmd has quit [Ping timeout: 240 seconds]
nvmd has joined #zig
Kingsquee has joined #zig
lucid_0x80 has quit [Ping timeout: 256 seconds]
elbow-jason has joined #zig
joaj has joined #zig
frett27_ has joined #zig
<marler8997__> g-w1 I'm on irc as well
<elbow-jason> hello zig people. I am a little stumped: https://gist.github.com/elbow-jason/9437018f6b2b0285439f1fce13cd5748
<elbow-jason> I can't understand why the values for fox3 and the2 are null.
frett27 has quit [Ping timeout: 260 seconds]
<marler8997__> g-w1 are you on irc right now?
<elbow-jason> actually looking at the logs it looks like I am not *actually* updating the hash_map values
<g-w1> yes
<g-w1> probably better to chat than github :P marler8997__
<alexnask[m]> elbow-jason: You need a StringHashMap(usize) here, the AutoHashMap hashes the slice and not the actual value of the string
<alexnask[m]> AutoHashMap used to error out for []const u8 keys for this reason iirc
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
<elbow-jason> oh awesome! It worked! Nothing quite like changing 1 loc and fixing the issue :) Thanks, alexnask[m]!
<alexnask[m]> (and you are incrementing the value twice when finding an existing entry)
<elbow-jason> Got it. This language is so simple. Me gusta.
wootehfoot has joined #zig
foobles has quit [Remote host closed the connection]
Ashpool has quit [Read error: Connection reset by peer]
Ashpool has joined #zig
<andrewrk> alexnask[m], how did it go with the mingw-w64 update? looks good to me
marnix has quit [Ping timeout: 264 seconds]
<alexnask[m]> I will do so tomorrow and update the status in the PR
<alexnask[m]> It seems to work well, I would like to test it on a couple more complicated C codebases before merging though, just to make sure everything works well
<alexnask[m]> The only thing that confused me is which idl files are included along with the headers, I kept the same set we already used but updated them but they seem arbitrarily chosen to me
<andrewrk> they are arbitrarily chosen
<andrewrk> I'm not sure we should add them all since some are very obscure and that adds quite a few additional MB to the tarballs. but if you have any suggestions, I am all ears
<andrewrk> I just tested the branch with legend-of-swarkland and was able to cross compile the game for windows as well as run it in wine, so it seems good to me
wootehfoot has quit [Quit: Leaving]
<alexnask[m]> Ok, that makes sense, I initially copied all of them over and noticed quite a bit size difference as well. This is ready to merge then
<andrewrk> nice work
wootehfoot has joined #zig
<alexnask[m]> cheers
<ifreund> how are release notes coming?
<ifreund> alexnask[m]: zls is so awesome, I'm porting river to zig-wlroots now and goto-definition is saving me a lot of time
<andrewrk> I'm really behind on release notes
<andrewrk> I'm going to have to change the format to save time during this release cycle
<ifreund> :/
<andrewrk> it's already a crunch week, but with this getting ousted from where I live situation, it just sucked up so much time away from me
<ifreund> yeah, that totally sucks
<ifreund> I hope my goal of getting non-zig people to start using software written in zig will come to fruition this release cycle
<ifreund> it already has for a couple people tbh
<elbow-jason> andy you can always come back to AZ. We won't kick you out.... all joking aside I hope you are okay.
<alexnask[m]> ifreund: <3 Could be way better though.
<alexnask[m]> Hopefully we can get stage2 to a usable level by 0.8.0 and I can work on a semantic server in the compiler for 0.9.0
<ifreund> can't wait
<ifreund> oh one thing, shouldn't opaque{} things be highlighted as types?
<ifreund> I've been too lazy to open an issue
<alexnask[m]> I added an opaque token type
<alexnask[m]> In keeping with struct, union, enum
<ifreund> ah so I just need to update my config then I guess, thanks
<ifreund> sweet, that was easy
<alexnask[m]> Maybe I should move struct, enum, union, opaque to token modifiers and always use type for the token type
<alexnask[m]> Hadnt really considered this till now for some reason :P
<ifreund> yeah I dont think any sane person will highlight all of those with different colors
<alexnask[m]> looks at config in shame
tane has quit [Quit: Leaving]
<alexnask[m]> They are similar, in my defence, I only set them up for testing and havent changed them
wootehfoot has quit [Read error: Connection reset by peer]
<ifreund> heh
Ashpool has quit [Quit: Leaving]
donniewest has quit [Quit: WeeChat 2.9]
Patrice_ has joined #zig
<mla> does anyone have an example of reading a /dev device file in zig? struggling to read /dev/input/eventX; trying to do w/ std lib / not w @import c
frett27_ has quit [Ping timeout: 260 seconds]
<ifreund> mla: maybe look at what libinput does? This is more a question of how to use the /dev/input/event* interface
omglasers2 has quit [Read error: Connection reset by peer]
<mla> ifreund: hm yeah thing is im getting an unreachable error trace pointing to EINVAL from std.fs.read so thinking maybe this is a std err bug
<ifreund> what are you passing to read?
<ifreund> note that you will likely need root perms to read /dev/input/*
<mla> cat /dev/input/event0 works file though
Barabas has quit [Ping timeout: 245 seconds]
<mla> works fine* though
<justin_smith> I'm trying to remember, how do I iterate a *Foo[] using for?
<alexnask[m]> `for (foo_collection) |foo| { ... }` will work for []Foo, *[N]Foo
<justin_smith> error: index of single-item pointer
<justin_smith> I have *[]Foo, sorry I typed it wrong above
<alexnask[m]> `for (foos.*) |foo| { ... }` but pointer-to-slice is a weird type, seems weird to me that you would need it
skuzzymiglet has quit [Ping timeout: 260 seconds]
<justin_smith> alexnask[m]: yup, that did it, thanks
<justin_smith> alexnask[m]: I have it because a C library wants a void pointer to my "user data", and slice is my natural type, so I end up pointer casting from void
<alexnask[m]> Ah, I see
<justin_smith> I agree that pointer to slice is an odd place to end up, that's why the docs didn't really cover this case I'm sure
frmdstryr has quit [Ping timeout: 260 seconds]