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/
<andrewrk> daurnimator, debug build of llvm is the sledgehammer fallback plan for debugging that
<daurnimator> erk
<andrewrk> but if you're lucky, you passed nullptr to something in codegen.cpp:4031
<andrewrk> IMO if you're working on stage1, bite the bullet and have a debug llvm build available
<daurnimator> I'm not though :P
<andrewrk> is that an american idiom?
<daurnimator> ?
<andrewrk> "bite the bullet"
<daurnimator> Oh not sure; but I know that
<daurnimator> I was just saying I wasn't working on stage1
<daurnimator> --> It happened when I tried to use @asyncCall
<andrewrk> it means zig messed up something with the llvm types
<andrewrk> or passed null for something
<andrewrk> 99% chance that hits a helpful assertion in llvm debug build
<andrewrk> WendigoJaeger, I think your project would be well-received if you posted a link on hacker news, /r/programming, or lobste.rs
<stratact> <andrewrk> var args's days is numbered ... `KV{ .key = reached unreachable code` 😢
<WendigoJaeger> andrewrk: I'll wait to have a more elaborated demo that 3 pixels
<andrewrk> WendigoJaeger, up to you :) people love to see something approachable though. the "hello world" in the title makes it sound like they would be able to understand the code
adamkowalski has joined #zig
<emekankurumeh[m]> WendigoJaeger: nice! I tried to get that to work for the longest time!
<leeward> I just got an error on this expression: `@intCast(u16, val & 0xffffff)` (semantic analysis, can't be coerced into u16) but I believe that (val & 0xffffff) will always fit in 16 bits and I want to assert that (val & 0xff0000) is always zero. Is this a bug in the semantic analysis, or should I just put my assertion on its own line?
<WendigoJaeger> leeward: your litteral is a u24, not u16
<WendigoJaeger> emekankurumeh[m]: Did you publish any WIP somewhere ?
<leeward> WendigoJaeger: I noticed.
<leeward> Never mind though, it turns out my source type was actually a u16.
<leeward> It works as I expect when it's wider.
<dbandstra> andrewrk: do you use any tricks or special tools for editing long source files in vim?
<andrewrk> leeward, it's planned for this to work, I can't remember the issue number
<andrewrk> "Runtime Hint System"
<andrewrk> dbandstra, multiple buffers open to the same file, search (the `/` key), ctrl+o / ctrl+i
<andrewrk> sometimes I will have as many as 3 different vim tabs all looking at ir.cpp, each one with multiple split views...
<adamkowalski> andrewrk: is there any documentation about runtime polymorphism in Zig?
<adamkowalski> It sounds like there are two options, but I wanted to see if i'm missing any. union(enum) for when you have a closed set
<stratact> Alright, time I started to clean/finish up my terminfo.zig module and throw in a PR today to show I wasn't slacking. No sense in fighting Zig's print formatting for checking correct data in the StringHashMap entries.
<andrewrk> adamkowalski, there are no language features for runtime polymorphism. the main issue for that is https://github.com/ziglang/zig/issues/130. there's an interface pattern in the std lib, but it's convention only. daurnimator is promoting this "mixin" strategy. tgschultz has pioneered several other options
<adamkowalski> and a struct with function pointers (a la allocators)
<adamkowalski> Well maybe I don't even need it. But here is the problem I'm encountering. I'm building up a computation graph. There can be constants, variables, placeholders or operations
<andrewrk> adamkowalski, this topic is not considered to be stable yet, it's acknowledged that there is an issue here, especially as frmdstryr has been examining the performance of buffered input/output streams
<adamkowalski> the constants can be ndarrays but the element types can vary
<andrewrk> but yeah why don't you explain your use case and maybe #zig can give advice
<Snektron> andrewrk, i think theres a regression
<adamkowalski> the operations must be open to extension because people can add new operations that I didn't think about
<Snektron> All examples fail due to a missing @call
<dbandstra> somehow, i didn't realize you could hit Ctrl+O more than once (started using vim earlier this year). thanks for the tips :)
<Snektron> i suppose that's work-in-progress
<adamkowalski> but it's all the standard linear algebra operations like matrix multiplication, add, subtract, div, convolution, etc
<adamkowalski> So I was thinking about having 4 arrays, one for constants, one for variables, etc...
<adamkowalski> Then things like operations would have pointers to a enum(union) of constant, variable, operation, placeholder
<adamkowalski> An an operation would be an "interface" like allocators
<adamkowalski> does that all sound reasonable, or is that just me bringing an object oriented mindset
<Snektron> wait, how does this work
<WendigoJaeger> andrewrk: Hacker News https://news.ycombinator.com/item?id=21739514
<Snektron> O
<Snektron> I see my problem, called wrong Zig executable
<Snektron> still doesn't explain the problems on the documentation
WendigoJaeger has quit [Ping timeout: 245 seconds]
adamkowalski has quit [Ping timeout: 265 seconds]
<emekankurumeh[m]> WendigoJaeger:
<emekankurumeh[m]> sadly no
adamkowalski has joined #zig
<andrewrk> Snektron, can you point out one problem in particular?
<adamkowalski> andrewrk: can you take a look at this? I feel like my test "add" at the very bottom should pass: https://pastebin.com/zUgUuFbU
<adamkowalski> The tests fail when I run both of them, but if I run just one then it passes
<adamkowalski> The pointer values magically change if both tests run haha?
<adamkowalski> The failing test is: std.testing.expectEqual(x.constant, z.operation.left.constant);
<adamkowalski> Or: std.testing.expectEqual(y.constant, z.operation.right.constant);
<adamkowalski> individually they pass but if you uncomment both they fail
adamkowalski has quit [Ping timeout: 250 seconds]
<Snektron> andrewrk, i think the master documentation is from a commit with wrong code from a few days back
<Snektron> I myself had a similar problem, because i was accidently using the system Zig compiler instead of the freshly compiled one
<Snektron> Which was from that same time
adamkowalski has joined #zig
adamkowalski has quit [Ping timeout: 276 seconds]
adamkowalski has joined #zig
<daurnimator> also interesting HN thread: https://news.ycombinator.com/item?id=21736342
<dbandstra> adamkowalski: did you figure out the problem with the code you posted an hour ago?
<daurnimator> A thought once we get "bounded" integers: `open()` would in theory be a `[:0] @boundedInt(1,255)`: though the sentinel is not a member of the type..... I wonder if there's something we can do there.
<andrewrk> sentinel termination is for in-bound values. you'd use a `?` for an out of bound sentinel
adamkowalski has quit [Ping timeout: 268 seconds]
<daurnimator> a `?`?
adamkowalski has joined #zig
<andrewrk> I see what you're saying
<fengb> I found an off by one error by rewriting these wasm tests -_-
mforney has quit [Read error: Connection reset by peer]
mforney has joined #zig
<adamkowalski> dbandstra: not yet. Do you have any thoughts?
<daurnimator> andrewrk: I've been wondering if its worth setting up a weekly "zig update" meeting to engage the community. It's something the k8s world does a lot.
<dbandstra> adamkowalski: the tests run fine for me, but i might be just lucky. it looks like you're returning pointers to stack locals
<andrewrk> I could see this happening
<dbandstra> adamkowalski: return `Tensor(T){ .operation = &o };` where o is a local
<adamkowalski> Well I don't them to be stack locals. I want to allocate the memory in the ArrayList that the graph owns and return a pointer to that
<dbandstra> i think you could use array list's `addOne` function https://pastebin.com/raw/9f3d5gMJ
<adamkowalski> But I don't want the API to be based around pointers, I want you to believe you're dealing with a Tensor, even though it's really just a handle to memory that the graph one
<dbandstra> however i'm not familiar with zig array lists and i'm not sure if those pointers will stay valid
<dbandstra> maybe you could call `count()` before appending to get the index of the new element, and store that
<adamkowalski> Your add one idea was spot on! Thanks
<adamkowalski> It gives me back a pointer to the newly allocated operation and then I just mutate it in place.
<dbandstra> yes, i'm just worried that when the arraylist reallocs itself to expand, the pointer could be no longer valid (hence why storing an index might be a better idea)
<adamkowalski> Hmm, so you're saying do away with the pointers alltogether? Just have a union(enum) which tells you which array to look into, and then deal only in indices?
<adamkowalski> I'll try that
<stratact> is there a way to do comptime imports?
<daurnimator> aren't all imports comptime?
<stratact> I want to block the `net` variable for FreeBSD as a temporary hack.
<stratact> in the std lib
<stratact> otherwise `zig build test-std` is big ouch for me
<daurnimator> stratact: use --test-filter?
<adamkowalski> dbandstra: I got the tests to pass with the index based approach, I like it but it's a bit more verbose. Is there anything you or anybody else can recommend that I can do to make my code more idiomatic Zig?
<stratact> daurnimator: -Dtest-filter is not working for me
<stratact> it's only blocking every test
<daurnimator> stratact: what are you trying to test?
<dbandstra> adamkowalski: the code you posted looks pretty good to me. i believe the idioms are still evolving. i personally can't give much advice on the std lib because most of it i haven't used or touched
<stratact> daurnimator: sorry nevermind, I figured it out what you meant earlier. I must of forgot there was a `zig test` command
<dbandstra> i'm no clearer than i was 1 year ago or 10 years ago how to approach polymorphism... currently wrangling with it again in a new project
muffindrake has quit [Ping timeout: 250 seconds]
muffindrake has joined #zig
<daurnimator> dbandstra: comptime time polymorphism or runtime?
<daurnimator> for comptime you can use mixins. for runtime you need @fieldParentPtr or a vtable.
<adamkowalski> daurnimator can you elaborate on those? I think the standard library uses just the vtable approach right? They just have a struct with function pointers that you have to fill in
<adamkowalski> For comptime what i've been doing so far is accepting a parameter by var and then checking if it matches the interface I need
<daurnimator> adamkowalski: no. the standard library uses @fieldParentPtr. I don't think anyone has done a vtable in zig yet
<dbandstra> daurnimator: even which of those to choose has to be considered
<andrewrk> hejsil and tgschultz both experimented with vtables and found llvm to optimize them better than @fieldParentPtr
<andrewrk> which makes sense since this is what c++ and other languages emits. according to my understanding it is arbitrary and not fundamental, the reason llvm does not optimize the @fieldParentPtr pattern, even though this would benefit other codebases, such as the linux kernel
<adamkowalski> andrewrk: if we don't have any docs for this, could we get some people together to get something started?
<andrewrk> docs for the interface pattern?
<adamkowalski> I can volunteer to get the ball rolling. If you can point me to where I can read about this more, or example projects that leverage
<adamkowalski> I can try to write about what the different methods are, example implmementations, pros and cons
<adamkowalski> Maybe you can look at them and yell and say they are terrible. Then we do a second draft
<adamkowalski> and eventually they will be fine
<dbandstra> there's definitely some prior work buried or linked to in some old zig issues
<adamkowalski> Well phase one can be just building a document with link to all prior work
<dbandstra> that would be good
<adamkowalski> And we can talk about when you can leverage compile time polymorphism, and the tradeoffs between specialization and icache bloat
<adamkowalski> And then runtime polymorphism, when is it necessary, what are the alternatives, and so on
<tgschultz> MY current thinking on interfaces is that "mixins" with a built in function to abstract to a runtime-unknown version of the interface are probably the best available generalized mehtod. Though there's still some things to be worked out with errorsets there.
<stratact> Finally, I got a PR up, time to celebrate with food.
ur5us has quit [Ping timeout: 250 seconds]
<tgschultz> I can't seem to type "My" these days without capitalizing the Y as well. I did not intend any emphasis on the word.
<andrewrk> congrats stratact
<tgschultz> Though I personally don't want to encourage the "mixin" pattern, it is convenient for this usecase.
<adamkowalski> What do you all think about the dyno library from C++? It is designed to handle runtime polymorphism without inheritence
<adamkowalski> It's by Louis Dionne who is a really interesting speaker
<adamkowalski> And there is also sean parents talk: https://www.youtube.com/watch?v=QGcVXgEVMJg&t=1s
<adamkowalski> He tries to keep polymorphic types as value types rather then reference types
<tgschultz> daurnimator yeah that's basically what I'm talking about.
<tgschultz> I hadn't seen that comment though
<daurnimator> tgschultz: whats the error set issue you allude to?
<daurnimator> tgschultz: FWIW I was trying to make the error set creation automatic, but ran into https://github.com/ziglang/zig/issues/3699
<daurnimator> for now with e.g. InStream, I just make part of the mixin expectations that you have `Self.ReadError`
<tgschultz> streams are complicated to use because of the errorsets, and trying to make them work with the interface pattern tends to run you into a lot of bugs and shortcomings with inference. That's all fixable though.
<tgschultz> A PR to switch over all the interfaces is std wouldn't be as much work now as it was when I was experimenting (we still had that sync-requires-an-allcoator thing going on. Oy).
<andrewrk> I have poured gasoline all over var args: https://github.com/ziglang/zig/pull/3873
adamkowalski has quit [Ping timeout: 268 seconds]
<stratact> andrewrk: thank you, granted my work could use some supervision. I took a lot of liberty to do things my style, to overcome the harder challenge.
return0e has quit [Ping timeout: 250 seconds]
<stratact> What matters to me is I show the forethought
return0e has joined #zig
adamkowalski has joined #zig
<emekankurumeh[m]> please drop the match
<daurnimator> tgschultz: https://github.com/daurnimator/zig/tree/stream-mixin <-- this is my branch where I switch it over. it's on top of a couple of other open PRs
<daurnimator> andrewrk: `std.debug.warn("foo", .{})` is pretty awkward.
<emekankurumeh[m]> default function arguments?
<dbandstra> or maybe "warn" and "warnf" functions
rappet has quit [Read error: Connection reset by peer]
rappet has joined #zig
<mikdusan> formatting without any format placements is rare
<andrewrk> write() is the one without any format args
<daurnimator> andrewrk: can I still call a C vararg function?
<andrewrk> yes that's unrelated
<daurnimator> missing: the ability to write a C vararg function
adamkowalski has quit [Ping timeout: 240 seconds]
ltriant has quit [Quit: leaving]
_whitelogger has joined #zig
<stratact> daurnimator: thanks for the reviews. I'll wrap up the rest tomorrow. Have a look at the reply I made for one regarding name tokens. I spent so much energy on out of memory errors for allocators that I didn't realize I was being too conservative. :P
<stratact> Good night o/
THFKA4 has quit [Ping timeout: 246 seconds]
SimonNa has quit [Remote host closed the connection]
ur5us has joined #zig
ur5us_ has joined #zig
ur5us has quit [Ping timeout: 246 seconds]
ur5us__ has joined #zig
ur5us_ has quit [Ping timeout: 245 seconds]
merlyndmg has joined #zig
<merlyndmg> hey. I'm working on trying to further flesh out translate-c-2. I have implemented binary mul, div, and rem without any problems.
<merlyndmg> However, I tried enabling the test case for them, and the functions won't print out because they have parameters, and function signatures don't seem to print out if you have those. I have spent some time trying to get that working, but I think I'm getting stuck on this: do I have to output tokens in order?
<merlyndmg> Trying to figure out if I need to output the tokens in the middle of what is currently finishTransFnProto
<merlyndmg> I tried outputting them after that function, and I get a segfault later. I think when rendering them
dbandstra has quit [Quit: leaving]
return0e_ has joined #zig
ur5us has joined #zig
ur5us__ has quit [Read error: Connection reset by peer]
ur5us has quit [Ping timeout: 250 seconds]
<mq32> hey
<mq32> anyone in for a "zig run -" and read the code from stdin? :D
<mq32> this would allow using zig as a shell script language
_whitelogger has joined #zig
dddddd has joined #zig
ikan-keli_ has quit [Ping timeout: 240 seconds]
Demos[m] has quit [Quit: killed]
dtz has quit [Quit: killed]
emekankurumeh[m] has quit [Quit: killed]
BitPuffin has quit [Write error: Connection reset by peer]
fengb has quit [Quit: killed]
Snektron has quit [Quit: killed]
D3zmodos has quit [Quit: killed]
D3zmodos has joined #zig
merlyndmg has quit [Remote host closed the connection]
merlyndmg has joined #zig
Demos[m] has joined #zig
dtz has joined #zig
BitPuffin has joined #zig
Snektron has joined #zig
fengb has joined #zig
hio has joined #zig
<bgiannan> reading the doc, i'm not sure what happens when a programs hits an unreachable of release fast mode?
<bgiannan> on*
<mq32> bgiannan: It's undefined behaviour
<mq32> so: nobody can tell you
<bgiannan> Right but if you have say: { ... unreachable; std.debug.warn("hello"); } Either the program stops at the unreachable statement or it doesn't.
<daurnimator> bgiannan: its more complex than that: if you reach the unreachable. things may go wrong *anywhere*
<daurnimator> like, you might fall into some other code that assumes that flags are set a certain way, and they get interpreted incorrectly and ends up `rm -rf`-ing your hard drive
<mq32> simple example:
<mq32> fn a() void { unreachable; } fn b() void { std.debug.warn("hello!"); }
<mq32> if you now call a(), it is possible (and allowed by the definition of UB) that b is called
<bgiannan> wow i see
<mq32> in terms of "a gets called and then the code of b gets executed"
<daurnimator> bgiannan: --release-fast is "go fast at any cost". if you're doubtful of any of the code you use.... use release-safe instead
<bgiannan> so how is std.debug.assert safe to use then?
<bgiannan> daurnimator, yes i'm considering it since i have no performance issues right now
<mq32> assert is safe as in "you assert (guarantee) that the argument is always true"
<bgiannan> right
<mq32> it's not a safety net to make sure "program stops when this condition is false", but "if this condition is not true, the program is not correctly programmed"
<daurnimator> bgiannan: unreachable is funny in that the compiler "works backwards" from it. => `if (x == false) unreachable` => in release-fast that means, "the code *before* and after is free to assume x isn't false"
<daurnimator> if it turns out x *is* false.... well you may have run the entirely wrong code
<mq32> this is a neat example on "what happens"
<mq32> you can see in assembler that both a and b are literally the same function as they point to the same memory address
<bgiannan> mq32, i think something like `if (builtin.mode == .Debug) { assert(...) }` is something i would be more comfortable with then
<daurnimator> bgiannan: assert actually becomes magic "go faster" source: because you get to tell the compiler all the corner-conditions that it neednt worry about
<daurnimator> s/source/sauce/
<bgiannan> i always thought of assert being something `compiled out` of the production binary
<daurnimator> bgiannan: right: its compiled out; because the compiler would hit unreachable if it *did* run it
<daurnimator> and because unreachable isn't allowed to be reached. it *must* be true
<mq32> nice example for "it gets compiled out": https://godbolt.org/z/_URJnz
<bgiannan> right but it does affect the resulting program
<daurnimator> bgiannan: https://godbolt.org/z/QmY2xU
<mq32> yes
<mq32> that's the whole idea behind "unreachable"
<bgiannan> of unreachable yes
<mq32> otherwise you can just do "if(!true) exit(1)"
<bgiannan> but not of assert like i think about it
<mq32> it's usual in C/C++ to define assert in release modes to something like __expected which does the same as unreachable
<bgiannan> daurnimator, https://github.com/ziglang/zig/pull/3872 makes me think i could rewrite sirocco in zig
<frmdstryr> daurnimator: How far did you get with the HTTP parser?
<daurnimator> frmdstryr: pretty far. hit a zig segfault trying to benchmark it and now I need to recompile llvm in debug mode :(
<frmdstryr> What segfault? Was it trying to use async?
<daurnimator> yep
<frmdstryr> Is it in the h1 branch?
<frmdstryr> I had a bunch of issues when using async only to find out I wasn't saving the frames somewhere
return0__ has joined #zig
return0e has quit [Ping timeout: 240 seconds]
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen1 has joined #zig
dingenskirchen1 is now known as dingenskirchen
<daurnimator> frmdstryr: "it"?
<daurnimator> I have a few updates to the h1 branch + I didn't put in the example program
<daurnimator> but really the general strategy is the same as the h1 branch
<frmdstryr> "it" as in the code where the error is occuring
<daurnimator> frmdstryr: http://sprunge.us/Ae0VfP
<frmdstryr> Why's the loop beginOneEvent commented out?
<daurnimator> because it didn't seem to help or hinder
<daurnimator> and I was sort of throwing shit at the wall to see what compiles in the end
<daurnimator> I couldn't get async working :(
<frmdstryr> is the error somewhere?
<frmdstryr> or just wont build?
<daurnimator> won't build
<frmdstryr> did it work just using `async handleConnection`?
<daurnimator> well yeah.... but that doesn't save the stack frame anywhere
<frmdstryr> instead of @asyncCall use frame.* = async handleConnection(...)
<daurnimator> http_test.zig:34:14: error: attempt to dereference non-pointer type '[]align(16) u8'
<daurnimator> frame.* = async handleConnection(allocator, conn);
<daurnimator> frmdstryr: ^ how?
<frmdstryr> const frame = try allocator.create(@Frame(handleConnection));
<daurnimator> oh right its a slice not a pointer
return0e has joined #zig
return0__ has quit [Ping timeout: 265 seconds]
emekankurumeh[m] has joined #zig
<stratact> daurnimator: ah interesting, fixup without the git rebase tui. I suppose this means I need to squash my commit pile to make it easier to follow changes.
<daurnimator> frmdstryr: http://sprunge.us/EacJua :D
<daurnimator> stratact: yep :)
<daurnimator> stratact: I use `git fixup` *all* the time
<frmdstryr> nice :)
<frmdstryr> can you bench it with wrk?
<daurnimator> apparently not. segfault :(
* daurnimator debugs
<daurnimator> damn it. my logic in 94485b2a58f8efbfb61e46d2efa257420f12a22d was buggy
<daurnimator> frmdstryr: with wrk I hit my old friend `FileDescriptorAlreadyPresentInSet`
<frmdstryr> Yeah I think the event loop needs some fixes
<stratact> daurnimator: I'm amazed. Your reviews in my PR are not only exposing me to more Zig features but it shows your well thoughtout forethought... it's godly
<stratact> I'm implementing the tagged union idea right now
<daurnimator> stratact: forethought? I make 50% of this shit up as I go along :P
<daurnimator> frmdstryr: andrewrk: http://sprunge.us/1grmGh <== output under `strace -e epoll_ctl`
dingenskirchen has quit [Remote host closed the connection]
<stratact> daurnimator: I'm beginning to see that now, but still, the ideas are cool ;) ... Sadly Zig won't allow enum literals to have field access to internal enums
dingenskirchen has joined #zig
<daurnimator> stratact: could you rephrase that?
<daurnimator> or give an example?
<stratact> error: type '(enum literal)' does not support field access
<stratact> .{ .short = "bw", .long = .boolean.auto_left_margin },
<daurnimator> `.long = Booleans.auto_left_margin`?
<stratact> worth a shot, will do
<stratact> error: expected type '@TagType(Terms)', found 'Boolean'
<stratact> .{ .short = "bw", .long = Boolean.auto_left_margin },
<daurnimator> stratact: I'll need to see more context than that
<daurnimator> stratact: show me the whole code....
<daurnimator> in particular the definition of Terms...
<stratact> I'll push what I have to the PR for easier view
<daurnimator> stratact: oh doh. it will be `.long = .{ yourTermsfieldName = .auto_left_margin }`
<stratact> Oh I see, I'll give that a whirl :)
<stratact> Got it working now.
<daurnimator> frmdstryr: I'm thinking that event.net is just broken
<daurnimator> is it *meant* to resume from another thread from where code was suspended?
dimenus has joined #zig
<dimenus> is zig's stdlib supposed to provide '__gxx_personality_v0'?
<daurnimator> dimenus: no. isn't that symbol a C++ thing?
<dimenus> i'm linking with a base c++ library that provides a c api
<dimenus> libgcc and libstdc++ are both statically linked into the so
<andrewrk> it looks like that symbol is supposed to be provided by libstdc++
<daurnimator> dimenus: that symbol should be provided by libstdc++?
<andrewrk> you might try -fno-exceptions for your C++ code
<dimenus> it's referenced by libunwind
<dimenus> andrewrk: tried that, no dice
<andrewrk> you verified that libstdc++ is on the linker line?
adamkowalski has joined #zig
<dimenus> yep, and it's not referenced in ldd
<dimenus> it's definitely this lib causing it though, no issue if i remove it from the build
<dimenus> andrewrk: wait, on the zig linker line or my gcc call?
<andrewrk> it sounds like the lib depends on this symbol, which means when it ultimately gets linked into a dynamic library or executable, libstdc++ needs to be on the linker line
<andrewrk> so, the zig linker line, if you're linking with zig
<andrewrk> it might be nice for zig build system to have a function to link against system libstdc++. here is where we do it for self-hosted: https://github.com/ziglang/zig/blob/5874cb04bd544ca155d1489bb0bdf9397fa3b41c/build.zig#L303-L328
<dimenus> hmm, that's strange to me. clang claims it doesn't need libstdc++ when linking
<dimenus> buut adding 'stdc++' to my build.zig totally fixed it on the zig side
<fengb> Why does the build sit on a user prompt?
<andrewrk> no idea
<andrewrk> for WasmPageAllocator I doubt there is a windows-specific problemh
<andrewrk> you ready for a merge btw?
<fengb> Yeah, things look pretty good
<fengb> I end up mapping ~270 MB of ram, which is pretty slow in Rust wasm
<fengb> But everything else seems to be working fine
<andrewrk> sweet. I'll try to merge that today
presiden has joined #zig
<fengb> Cool
presiden has left #zig [#zig]
waleee-cl has joined #zig
<andrewrk> alright, new non-var-args formatting API is in master. apologies for the code churn
<mq32> andrewrk: does the new syntax only support tuples or also anonymous structs?
<mq32> so: with field names
<andrewrk> it's planned to support that, but I did not add such functionality to the formatting implementation
<mq32> okay :)
<mq32> because this will be one heck of a cool feature
<mq32> same level of improvement as soon as you discover that regex supports named captures :D
<Pistahh> andrewrk: from now on do we need to add an extra ',.{}' to e.g. std.debug.warn even if we want to print a static string only?
<andrewrk> yes
<andrewrk> because var args is getting deleted from the language
<mq32> do i remember right that your plan is to remove the T { … } syntax for struct initialization?
adamkowalski has quit [Quit: Lost terminal]
<andrewrk> possibly. `T { }` syntax is equivalent to `@as(T, { })`
<andrewrk> `var x: T = .{ ... };` is equivalent to `var x = T{ ... };`
<mq32> hmm
<mq32> don't know if i like that, but i can understand why it's appealing
<andrewrk> Pistahh, if you have a stream, you can use `write` instead of `print` to avoid that extra parameter
<frmdstryr> With the var args pr just merged how is someone supposed to distinish between a tuple `.{}` and a struct `.{}`
<mq32> frmdstryr: it's the same thing
<mq32> tuples are just structs with auto-named fields
<andrewrk> there's no difference between a tuple with zero fields and a struct with zero fields
<andrewrk> yeah also what mq32 is correct; tuples are structs
<mq32> andrewrk: btw, on the topic of {} syntax: is it possible in userland to somehow utilize the "block type" passed to @cImport?
<andrewrk> it's not possible
<andrewrk> @cImport is doing special case analysis
<Pistahh> andrewrk: mostly I want to print something. I am a nobody here so I don't think my opinion matters (that much), so feel free to ignore me - but I have the feeling that too many things get oversimplified just for the sake of language simplification, and the "user experience" is secondary. (I'm not arguing, it is your language, you are the boss, your decisions. These just make me like zig less :(
<andrewrk> you're not wrong. but that's always been one of the explicit design principles- favoring language simplification over convenience for the typist
<mq32> Pistahh: how i stopped worrying and learned to love the typing:
<mq32> i have noticed something very special when coding zig
<mq32> i feel more powerful when coding with it, because you have to use less brain to actually produce zig code and thus can use more capacity to actually solve problems
<mq32> even though zig is sometimes overly verbose, if you are a good typer (and every programmer should become one eventually), it doesn't matter if you write & or 'addressOf
<mq32> but it's an experienced thing (at least by me) that i have solved some problems much more elegent and simple than before
<mq32> less code, less complex
<mq32> so: thumbs up to andrewrk for actually getting to where he wants to go with zig: "big brain time" :D
<companion_cube> good tooling can also help with that (like a good LSP implem)
<companion_cube> I know that it takes me less brain to program with such tools, cause I know if I do something wrong I'll get a red squiggle
vegai has joined #zig
<fengb> I'm not the biggest fan of letting IDE solve language problems. That leads to Java :/
<mq32> companion_cube: that's actually a false friend
<mq32> the point is: you don't want the red squiggle when you type your thought, but afterwards
<mq32> because as soon as that red line pops up, your train of thought is stopped and runs against a red squiggle
<mq32> then you fix a trivial syntax error, and start thinking again
<mq32> i reduced all the code helpers to a bare mininum
<mq32> manual compiling, then red squiggles
<mq32> manual code completion trigger, not automatic
<andrewrk> fengb, have you tried coding Java with a good IDE (such as eclipse) and practice using all the keyboard shortcuts and refactoring tools? it's incredible
<mq32> also disabled all template stuff, because i have to remember them
<andrewrk> it's some next-level productivity
<andrewrk> I'm talking keyboard shortcuts to auto- extract snippets into functions, and vice versa
<mq32> andrewrk: yeah that's true
<andrewrk> keyboard shortcuts that is scope-aware
<mq32> refactoring tools are awesome, also in VS+C#
<andrewrk> and type-aware
<companion_cube> mq32: yeah I'm used to triggering completions, but it's very nice because I know I don't have to remember exact names (nor to type them)
<companion_cube> just complete stuff, if it completes it'll work
<mq32> companion_cube: yeah, that's the point. auto-completion helps, but as soon as it tries to think for you, it actually hinders you
<mq32> because then you start coding against your IDE
<andrewrk> IDE support is no joke, one of java's biggest accomplishments. the main thing they solved is they have no conditional compilation
<companion_cube> yeah I removed `coc` from my vim config
<andrewrk> if zig can solve this with multibuilds, then we'll really be on to something
<companion_cube> but I still love to be able to complete with tab
<mq32> what is pretty nice in C#/.NET (and i assume java ides have this as well): "new Foo { X = 10, Y = 20 }", "Ctrl+." => "Create class in new file", "Enter"
<mq32> and you have a new file with the correct imports, class and property declarations
<andrewrk> if you get an error like "that function does not exist" you can hit a keyboard shortcut to create it for you, with the correct parameter types and return type
<fengb> andrewrk: yes it's great, but it also makes the IDE mandatory. And there's still mountains of boilerplate to wade through
<fengb> I love IDEs, but there's no reason for the underlying language to be crappy. C# is a lot more reasonable
<andrewrk> fair
<fengb> Or Kotlin
<companion_cube> well yeah, you want a good language with a good IDE
<fengb> There has to be a balance between Coffeescript's looseness and Java's straightjacket :)
<mq32> Yeah, Java without IDE isn't much fun
<mq32> C# is quite reasonable, if you remember a lot of class names
<mq32> also it's a dream to work with the commandline compiler
<mq32> "it just works"
<mq32> well, at least for .NET/Mono, i have bad experience with dotnet core
<daurnimator> fengb: agreed. java is a language that you can't write *without* an IDE. so much boilerplate, so much jumping around...
<scientes> also needs lots of java to write java
<scientes> 0xcoffeebabe
<scientes> 0xc0ffeebabe
dddddd has quit [Ping timeout: 268 seconds]
deesix has quit [Ping timeout: 268 seconds]
deesix has joined #zig
dddddd has joined #zig
<dingenskirchen> with varargs being phased out in favor of 'tuples'/structs, would something like `std.debug.warn("value: {ident}", .{ident = my_variable});` be possible?
<andrewrk> dingenskirchen, yes
<andrewrk> not implemented yet
<andrewrk> someone should probably make note of this on https://github.com/ziglang/zig/issues/1358
<dingenskirchen> amazing, I like to imagine that'd be a little more robust than index-based formatting strings ^^
dingenskirchen has quit [Quit: dingenskirchen]
dingenskirchen1 has joined #zig
dingenskirchen1 is now known as dingenskirchen
return0e_ has quit []
FireFox317 has joined #zig
<dimenus> andrewrk: did anyone do analysis to determine how bloat is affected by the std.fmt.format change?
aperezdc has joined #zig
ovalseven8 has joined #zig
<ovalseven8> Is Zig a suitable programming language for a next-gen operating system?
<andrewrk> dimenus, nope
<scientes> ovalseven8, why you want to create your own operating system?
<andrewrk> what do you mean by next-gen?
<ovalseven8> andrewrk, Almost every OS is C-based and at least a few decades old in its origins. With next-gen I mean a new one, with the lessons learned and without ballast
<scientes> ovalseven8, or C++
<scientes> something more realistic would be to write a driver in zig
<ovalseven8> scientes, Is Zig not low-level enough?
<scientes> ovalseven8, zig is great, but writing a kernel is a huge project
<scientes> if you want it to be useful
<scientes> I mean if you want something really simple, sure
<scientes> people are using zig for bare-metal
<andrewrk> ovalseven8, here is a related comment I made on reddit recently: https://www.reddit.com/r/osdev/comments/e56mwm/what_features_would_you_look_for_in_a_language/f9iinth/
<ovalseven8> As far as I read the website, Zig could provide some more compile-time guarantees compared to C, what would be good for kernels.
<andrewrk> summary: zig is even better than C for kernels, except for maturity. which is kind of a big deal
<andrewrk> but if you're willing to accept the caveat of immaturity, then zig is ideal for kernels, IMO
<scientes> also kernels require lots of obscure features
<scientes> like 8086 assembly
<ovalseven8> Yeah, for serious stuff Zig has to be stable before
<scientes> also you don't realize how good at C the linux devs are
<andrewrk> what does being good at C mean? abusing macros?
<ovalseven8> Had a (short) look at Rust and while I like its safety features a lot (!) it's not a programming language for hobby programmers, it's just to complex with so much features.
<andrewrk> I thought being good at C and being good at Zig was mostly the same thing
<andrewrk> ovalseven8, you might find this interesting: https://github.com/ziglang/zig/issues/3784
<scientes> well, mostly it is knowing the tricky parts of C
<scientes> and not macros
<andrewrk> zig supports a way for hobby OS developers to provide an OS package so that application developers can use the zig std lib to target your hobby OS
<fengb> Many of us are here because we failed at learning Rust :P
<andrewrk> including me
marmotini_ has joined #zig
<andrewrk> pixelherodev is taking advantage of this OS package feature, would probably be an interesting person here to chat with
<ovalseven8> Well, most of you are outstandingly intelligent, so I am sure you could learn Rust if you want. ;) I only deal on a hobby-level with a little bit programming and what I, as example, like about Golang is that it's just super readable even for inexperienced devs. :)
<scientes> ovalseven8, we would rather focus on the program than our knowledge of the language
<stratact> ovalseven8: they are amazingly intelligent. I learn a lot just from being here reading the chat ;)
<andrewrk> I like that about go as well
<scientes> that was part of the design of go
<scientes> and they did succeed
<ovalseven8> Go is criticized a lot about missing features. I like there is at least one programming language you don't have to keep track on the language changes.
<ovalseven8> I just wonder if Zig could guarantee memory-safety like Rust? Or is something like that only possible if you bloat the language with a lot of features.
<stratact> ovalseven8: no, and it shouldn't. The ownership model overcomplicates things and makes it less flexible to implement design
<scientes> ovalseven8, you cant guarantee things in languages without adding a escape value, that then gets overused
<stratact> I'm sick of wrapping my brain around strict compiler rules only to be filled with stress and fear.
<andrewrk> ovalseven8, safety is an ongoing project: https://github.com/ziglang/zig/projects/3
<andrewrk> there are 4 build modes. 2 of them are the "safe" modes
<andrewrk> but much of the safety is runtime checks
<ovalseven8> It's always a trade-off. In general I'd like to have a modern C alternative (small language, stable, simple), so perhaps Zig will be one in case it does not add more features.
<andrewrk> runtime checks means that the rules are simple, but you find out at runtime if you broke them
FireFox317 has quit [Remote host closed the connection]
<andrewrk> vs rust has complicated rules but you find out at compile-time if you broke them
<scientes> ovalseven8, the interpreter feature means that zig is far more complicated than say, c89, but no-one wants a non-optimizing compiler so that argument is kinda out the window
FireFox317 has joined #zig
<andrewrk> I do think that it's going to be possible to detect most use-after-free and bad ptr casts, but such safety does not exist in status quo zig
<ovalseven8> Is andrewrk the only main developer?
<andrewrk> you can get an idea of the last month of activity here: https://github.com/ziglang/zig/pulse/monthly
<andrewrk> I'm the only full time developer
<ovalseven8> andrewrk, I'm blown away due to your productivity :)
<andrewrk> this is what it looks like to focus on the application rather than try to learn how use c++ features ;)
<gonz_> I'm very happy with investing in andrewrk so far.
<gonz_> I think he's turned out to be a good captain of the ship.
<stratact> andrewrk is worth my $15 patreon-a-month
<andrewrk> yarr harr fiddle-dee dee
<andrewrk> hmm looks like I need to refresh the macos CI llvm tarball
<andrewrk> hmm my macos wants to upgrade to catalina
<stratact> ovalseven8: Doing PRs for Zig is also a real treat. All peer reviews have been positive, helpful, and mind-stretching.
<dimenus> i want to contribute on the compiler side but haven't had the opportunity recently :(
<dimenus> also, ir.cpp scares me
<dimenus> :D
<dimenus> and agreed wholeheartedly on andrewrk's stewardship
tav has quit [Quit: Connection closed for inactivity]
wootehfoot has joined #zig
ovalseven8 has quit [Quit: Leaving]
lunamn has joined #zig
<Snektron> hey andrewrk, i'm wondering why @typeOf to @TypeOf needs to still be accepted for another release cycle but other breaking features (the later proposed @bitReverse, or the removing of var args just now) don't have that?
<andrewrk> Snektron, mainly because it's such low effort to make this breaking change auto-fix itself
<Snektron> Fair enough
<Snektron> anyway, i've noticed that zig fmt on the std lib root doesn't actually handle all files
<Snektron> and there is also a small typo at reset_event.zig:115
<Snektron> ah
<Snektron> andrewrk, whats the point of the `seen` map in stage1.zig:Fmt?
<Snektron> Because the way i see it, recursively iterating over a directory tree shouldn't process the same file twice
<Snektron> unless symlinks are followed
<Snektron> anyway, it looks like the currently processed file is added to the hash map, but it is also free'd
<andrewrk> yes it's to avoid problems with symlinks
<Snektron> So the hash map is full of pointers to undefined memory
<andrewrk> good point, that looks broken
<Snektron> ill change it since im working on it anyway
<andrewrk> thanks
<andrewrk> valgrind should catch this error
<Snektron> yeah
<andrewrk> also GeneralPurposeDebugAllocator + #63 would catch this error
<Snektron> I had expected a StringHashMap to own its internal data
<andrewrk> there's BufMap for that. naming could probably be improved
<dimenus> HashMap doesn't make value copies?
<dimenus> then I also have bugs to fix... lol
<Snektron> yes, shallow copies
<dimenus> wait nvm, ignore me
wootehfoot has quit [Quit: Leaving]
SimonNa has joined #zig
<andrewrk> I wonder how expensive it will be to make every if into a switch 0 => ... 1 => ... else => @panic("branch on undef")
<Snektron> syntax wise?
<andrewrk> code generation wise
<andrewrk> that's what #63 means doing
<Snektron> Hmm
FireFox317 has quit [Remote host closed the connection]
FireFox317 has joined #zig
<Snektron> I think that basically means silently translating every type initialized to `undefined` into either a special type or a special value
ur5us has joined #zig
<andrewrk> in safe build modes, zig already writes 0xaa when you assign undef
<Snektron> i don't see type inference handling the former, and the latter would produce problems with types that span their entire container (any 64 bit type for example)
<Snektron> Yeah but what if i have an i64 that i initialize to 0xaa...?
<andrewrk> some types can't be distinguished between an undefined state or valid state
<Snektron> but not all
<andrewrk> most can
<Snektron> but you still need something for the others, so i guess that basically means augmenting the type
<Snektron> (i mean making everything silently a kind of optional)
marmotini_ has quit [Remote host closed the connection]
<Snektron> but that probably creates a few problems. I'm mainly thinking along the lines of arrays or i64 for example
<Snektron> of*
marmotini_ has joined #zig
<Snektron> A friend of mine did his bachelor's thesis on some kind of runtime safety implemented in clang
<leeward> Woot, executed a program that used malloc in my emulator.
<leeward> Now let's find out if it produces reasonable results.
marmotini_ has quit [Ping timeout: 246 seconds]
mahmudov has joined #zig
lunamn has quit [Ping timeout: 246 seconds]
<stratact> leeward: what kind of emulator is this?
lunamn has joined #zig
<andrewrk> I am pleased to announce that zig programming language no longer has var args. It is a compile error in master branch if you try to use them
<andrewrk> this is not related to C functions. C functions still work the same
<stratact> andrewrk: congrats on the change, I'm happy you are happy.
<emekankurumeh[m]> nice!
wootehfoot has joined #zig
<andrewrk> time to go on a bug closing spree
<andrewrk> var args never worked at compile time or with zero bit types. tuples do not have either problem
lunamn has quit [Ping timeout: 246 seconds]
<Snektron> hm
<Snektron> @typeOf(i32) produces very weird errors
<Snektron> oh wait, thats legal of course
<Snektron> (i had accidently forgot to make a better test case)
<leeward> stratact: AVR
<mq32> leeward: you write an AVR emulator?
<leeward> Yeah, it's something to do.
<stratact> leeward: no kidding? The 32-bit kind?
<mq32> could you *please* compile that for AVR? +grin*
<leeward> 8-bit
<stratact> ah gotcha, keep it simple of course
<leeward> atmega328p
<mq32> for what purpose?
<mq32> "for fun" or do you want to do something with the emulator afterwards?
<leeward> I'd like to get arduino-like stuff working in Zig, and I need to be able to debug it.
<leeward> I could use a real AVR emulator that already works, but this way I get to learn Zig and get more familiar with the platform.
<leeward> Number of bugs found in AVR instruction set documentation: more than 2
<mq32> haha
<mq32> they are probably already documented in an errate
<leeward> Odds are good.
<mq32> also, you are doing a useful project for the zig community :D
<mq32> because we could incorporate behaviour tests for the AVR8 platform :D
<leeward> Ooh, that could be useful.
<mq32> using your emulator for CI
<Snektron> Whats `align(x:y:z)` syntax?
<leeward> Though it would probably be better to use the emulator from Atmel for that.
lunamn has joined #zig
<mq32> heh
<stratact> (phew, eating that sandwich from grubhub was worth it (it was late). Now to rebase my PR from upstream master and reflect any possible varargs-to-tuples changes Andrew made)
<mq32> oh yeah, that will break a lot of stuff in the ZGS project as well
<leeward> stratact: Grubhub late? Gasp. That means it arrived!
<fengb> The title change means we're gonna start calling it tuples? :P
<stratact> leeward: I know, I'm entitled. But it was painful from fasting all morning ;)
<andrewrk> fengb, yeah it's tuples
<emekankurumeh[m]> so can we return tuples from functions? access individual elements?
<andrewrk> a tuple is a struct and has all the semantics of a struct, with the additional property that it can be coerced to arrays, and the `len` property works, and element syntax works
<andrewrk> yeah you can return a tuple from a function. what use case are you thinking of?
<andrewrk> if it's the division() use case, proper type for that would be `struct { quotient: T, remainder: T}` because the order of those return values is not significant
<leeward> stratact: I'm just commenting on their reliability. I think the last time we ordered grubhub it arrived several hours late. Doordash manages to be worse, but only just.
<leeward> andrewrk: Are tuples required to have only one type of element?
<emekankurumeh[m]> no, they can be heterogeneous like a struct or union
<emekankurumeh[m]> i was thinking something similar to tuples in Haskell
<leeward> emekankurumeh[m]: How can they be coerced to arrays then?
<emekankurumeh[m]> if they all have the same type
<emekankurumeh[m]> so .{0, 0, 0} is the same as [3]comptime_int {0, 0, 0}
<jonathon> If you deinit() an ArrayList, should it automatically free any items which had been appended to the ArrayList? I'm trying to narrow down an issue with continually increasing memory allocation and _think_ it's down to my use of an ArrayList... https://godbolt.org/z/qbVQhE ... alternatively I might need to do something with the ArenaAllocator's std.heap.page_allocator? e.g. explicitly create and destroy it?
hio has left #zig [#zig]
<Snektron> Alright that should do it
<andrewrk> they don't necessarily even have to all be the same type, just all have to be able to coerce to the array elem type
<andrewrk> jonathon, continually increasing memory - are you aware of how ArenaAllocator works?
<andrewrk> it frees nothing until everything at once
<Snektron> perhaps there should be an allocator that specializes on growing elements
<andrewrk> ArrayList is pretty good at that
<andrewrk> a good backing allocator for an ArrayList would be a general purpose allocator
ltriant has joined #zig
<leeward> Is linking to the C standard library and using malloc still the easiest way to get a general purpose allocator?
<Snektron> pretty much
<mikdusan> jonathon: the code you posted does not leak on my system (simple test, just ran loop without time delay)
<jonathon> andrewrk: I was going by the "how to choose an allocator" section, it should be deinit() at the end of the main program loop
<jonathon> so (theoretically) periodically freeing
<emekankurumeh[m]> is it better zig style to return anon structs or struct literals?
<andrewrk> emekankurumeh[m], since we don't have inferred return types, wouldn't that be determined by your return type?
leeward has quit [Quit: *Poof*]
mahmudov has quit [Ping timeout: 250 seconds]
<emekankurumeh[m]> i mean in a constructor is it better style to do `return @This() { ... };` or `return .{ ... };`
<jonathon> mikdusan: Hmm. That might mean it's leaking somewhere else and I did actually get the Zig memory allocation correct... :| I wonder if it's the C library rather than my code (though libmosquitto should be pretty well tested by now).
<andrewrk> emekankurumeh[m], I would prefer the latter, since the former is equivalent to @as( @This(), .{ ... } ), which is just unnecessary
mahmudov has joined #zig
<mikdusan> also `fn append` works with _arena_ passed to it but if you passed a different kind of allocator (like a general purpose one), the code would be undefined
<mikdusan> ^ jonathon
FireFox317 has quit [Ping timeout: 250 seconds]
<andrewrk> all these issues with var args are now solved: https://clbin.com/yZLfx
<emekankurumeh[m]> nice
<mikdusan> +1
<frmdstryr> How was the event loop code tested?
<frmdstryr> I can now get 40k req/s but it drops as I add more concurrency
<andrewrk> frmdstryr, it hasn't been tested more than a proof-of-concept
<andrewrk> that's the level of quality we're currently at here
<andrewrk> which is disappointing if you were thinking you wanted to rely on it, but exciting if you wanted to work on it
<andrewrk> there's also the problem to be aware of that std.os.write() is not integrated with the event loop yet
<andrewrk> so, if you increase concurrency, you'll have stalls that aren't supposed to be possible
<andrewrk> I'm working towards getting std.os.write() integrated. believe it or not, killing var args was part of the progress
<andrewrk> because the next step is going to be turning std.fmt.format into an iterator pattern, so that it does not use a callback
<andrewrk> and then the next step will be std.os.write
<frmdstryr> sounds good. Was there any thought about using fmt as a "templating engine"?
<andrewrk> is that not what it is?
<frmdstryr> Since it pretty much is already
<frmdstryr> Haven't explored it much more than simple debug statements
<dingenskirchen> there was someone talking about using @embedfile as format string, for a text adventure I think?
<mq32> dingenskirchen: wtf, nice idea!
<dingenskirchen> heh, don't congratulate me :V
<mq32> yeah, but thanks for sharing :)
<dingenskirchen> it was pixelherodev! context here: https://freenode.irclog.whitequark.org/zig/2019-11-03#25691173;
<jonathon> (OK, so I don't see a leak when I exe.linkSystemLibrary against the C library, but I do see the leak if I use Zig to compile the library from source with exe.addCSourceFile. At least it's not because of my Zig code and I can stop pulling my hair out trying to work out what I was doing wrong.)
adamkowalski has joined #zig
<fengb> Speaking of format bloat...
dimenus has quit [Ping timeout: 246 seconds]
<Snektron> what the fuck
<Snektron> i wanted to see how mad it was with Zig
<Snektron> (its the same with release-small)
adamkowalski has quit [Ping timeout: 250 seconds]
<frmdstryr> Is there a way to chain a callback after an async frame completes?
<frmdstryr> like defer frame.deinit(some_cb)
<emekankurumeh[m]> that should work
<Snektron> thats not when a frame completes
<emekankurumeh[m]> oh that's when it returns
<Snektron> you could write a wrapper async function i suppose
<andrewrk> frmdstryr, this is the same question as "Is there a way to chain a callback after a function call returns?"
<andrewrk> Snektron, if you add --strip (to get rid of debug info) and change f64 to u64 then the object file comes out to 2.1K
<andrewrk> tiehuis breaks down the binary size improvements of Ryu on the issue I linked
<Snektron> andrewrk, thats still really large
<Snektron> oh, ill go take a look
<Snektron> I think theres something more at play though'
<andrewrk> how big would you expect that object file to be?
<Snektron> Well considering the compiler is still spewing out a lot of simd code for a simple int to string, a lot less
<andrewrk> I don't see any simd code
<Snektron> https://godbolt.org/z/W_2Jhe this is what you meant right?
<andrewrk> yeah ok I see 4 simd instructions
<Snektron> looks like its also copying a whole lot of data from the stack
adamkowalski has joined #zig
<andrewrk> it goes down to 968 bytes if you use only unsigned ints
<daurnimator> frmdstryr: did you figure out the EEXIST error I was getting?
<frmdstryr> Not yet, still playing with improving memory allocation
wootehfoot has quit [Quit: Leaving]
<frmdstryr> But I didn't hit that error at all
<mq32> oh wow, that bufPrint doesn't look very nice
<mq32> (in terms of instructions-per-actual-ops)
<shakesoda> mq32: what do you think about making sdl_image optional in sdl.zig
* shakesoda doesn't use it or have it on any systems...
traviss has quit [Quit: Leaving]
<merlyndmg> I ran valgrind on the download page zig build. I'm getting errors galore. Thousands of them. On my local release build I'm getting almost no errors. Is that to be expected andrewrk ?
<merlyndmg> I've basically never used valgrind before, so I don't really know what things to filter out mentally :)
<daurnimator> merlyndmg: doing what operation?
<daurnimator> I don't think I get any warnings under valgrind unless my code is wrong
<merlyndmg> This is regarding bug 3838, regarding the translate-c that's spitting out nan's
<merlyndmg> lots of errors e.g. "Conditional jump or move depends on uninitialised value" on the download build, no errors on a local build with the same translate-c command on the same input.h file
<merlyndmg> I guess I can comment on the bug page instead. Just thought it might be faster to chat here. Since I'm not really conversant with this type of investigation maybe it's best to pass the ball to whomever can pick it up later