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/
msingle has quit [Ping timeout: 272 seconds]
ur5us has quit [Ping timeout: 244 seconds]
dermetfan has quit [Ping timeout: 272 seconds]
ronsor has quit [Ping timeout: 256 seconds]
cole-h has quit [Quit: Goodbye]
layneson has quit [Ping timeout: 272 seconds]
xd1le has quit [Read error: Connection reset by peer]
ur5us has joined #zig
zannzen[m] has joined #zig
xd1le has joined #zig
<mkchan> Huh... const stdout = std.io.getStdOut().writer(); fails on windows if I do it outside any method
<mkchan> Unable to evaluate constant expression pointing to some .x86_64 => ask volatile line
<mkchan> Asm*
reductum has quit [Quit: WeeChat 2.9]
<andrewrk> yeah windows is the main reason that getStdOut() is a function call rather than a global
<mkchan> Dammit windows... So I'll have to make it inside my print wrapper each time I guess
LanceThePants has joined #zig
sawzall has quit [Read error: Connection reset by peer]
<leeward> Yup, it's not awesome.
<leeward> It's one of the reasons why there's no std.io.in or std.io.out
zippoh has quit [Remote host closed the connection]
zippoh has joined #zig
zippoh has quit [Remote host closed the connection]
<mkchan> Now I'm actually not sure how to read until a line feed. On Linux reading till \n is good for my application because even when I use a console and type a command and press enter it sends \n
<mkchan> On windows my application still needs to read till \n but the terminal sends \r at the end and the readUntilDelimiterOrEof method only allows specifying a single delimiter
<leeward> Yeah, I've had trouble with multiple character delimiters before...I might have hacked it.
<leeward> Looks pretty hacky to me.
<mkchan> I kinda added an extra step
<mkchan> Basically I get the line till \n and trimright the \r
<mkchan> So carriage return from windows works out fine
<leeward> yeah
<leeward> Macs don't still use their CR-only endings, do they?
<pixelherodev> ... why did they ever?
<pixelherodev> That's got to be the stupidest one.
<fengb> Nope, switched to LF on OSX
<fengb> Mac Classic was \r
<pixelherodev> Both Linux's and Windows' are defensible, even if Windows' is so blatantly wrong.
<pixelherodev> \r on its own makes *no* sense though.
<leeward> I don't know, it sounds like the future to me. Who needs to line feed?
<leeward> Obviously if you're CRing you need to LF.
<fengb> lol... the switch happened before phd was born
<leeward> And if you're going to make something with no baggage that never needs to use a text terminal or a teletype, CR does seem reasonable.
<fengb> I feel old
<leeward> Ouch, fengb.
<leeward> I'm referring to the early '80s as the future.
<mkchan> I wish we had better tooling
<mkchan> Cmd > settings > set eol character > \n > apply
<leeward> I recently watched...https://www.youtube.com/watch?v=8pTEmbeENF4
<leeward> It hurt a bit.
<mkchan> I saw on HN that microsoft is apparently committing to linux regarding HyperV
<mkchan> I hope they just switch to linux
<leeward> That would be hilarious.
<leeward> What distro do you run? Windows.
<mkchan> But this is actually the year of the Linux desktop
<mkchan> What's this GNU thing people sometimes talk about
<leeward> Microsoft(TM) GNU/Linux Windows(TM)
<fengb> Would they keep any GNU around though?
<leeward> Are you talking about the HURD, or making a joke about Linux?
<mkchan> A little bit of many jokes
<leeward> check, funny.
<fengb> I used to joke about HURD... but it’s been long dead
<leeward> They'd probably ship with bash.
<mkchan> They already basically ship bash on wsl
<leeward> It's kinda sad, the HURD became viable about 8 years after it died.
<leeward> Right, but that's an application that runs under Windows, not part of the OS.
<mkchan> Yeah but I mean like they're not closed to linux stuff anymore
nephele_ has joined #zig
<leeward> It's true.
<leeward> They're in the embrace part of the cycle.
<leeward> Maybe with a touch of extend.
nephele has quit [Ping timeout: 260 seconds]
nephele_ is now known as nephele
<mkchan> Yeah but hard to extinguish basically the entire cloud
<mkchan> And mobile
<mkchan> And everything except desktop :)
<torque> not as hard as you'd think
<pixelherodev> leeward: because it means that you can't CR without LF
<pixelherodev> And I [ab]use CR all the time :P
<pixelherodev> They will almost certainly try to extinguish.
<pixelherodev> It really comes down to whether or not the communities are willing to put in the work to clean up the mess they make, which I suspect many will
<pixelherodev> I mean, systemd tried EEE too.
<pixelherodev> Whether or not you agree with them, the fact remains that they had as a fundamental goal extending Linux itself and extinguishing any platform which didn't include them.
xd1le has quit [Read error: Connection reset by peer]
<pixelherodev> Yet there are still numerous distros without it, simply because people put in the effort to make and / or maintain them.
<pixelherodev> In order for EEE to work, people have to accept the extensions themselves.
<pixelherodev> If MS attempts EEEing Linux itself, it wouldn't be *impossible*, but the challenge would be much higher than I suspect most people think it would be
xd1le has joined #zig
<mkchan> How do I tell zig to compile specifically using certain options like bmi, popcnt and see and such?
<mkchan> Sse*
<mkchan> I can see target and -mcpu but what I'm looking for is specific feature flags like -mbmi -mbmi2 -mpopcnt and such
<wilsonk> andrewrk: any chance you can do a video once #6250 lands to let us know the differences and features? :) ... I realize I could just read the release notes and code, but it might be more digestible for some people to hear it from you
<wilsonk> oh, sorry I just noticed on discord that there 'is a lot more work to do' so I suppose I am jumping the gun there
<andrewrk> yep!
<andrewrk> mkchan, -mcpu=? should give you a list of cpu features
factormystic has quit [Quit: The Lounge - https://thelounge.chat]
jicksaw has quit [Quit: ZNC is kill]
jicksaw has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
<andrewrk> mkchan, oops, do -mcpu=generic+?
<andrewrk> popcnt, bmi, bmi2 are in there
<andrewrk> -mcpu=generic-popcnt-bmi-bmi2 would disable those three
msingle has joined #zig
mokafolio has quit [Quit: Bye Bye!]
mokafolio has joined #zig
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
ur5us has quit [Remote host closed the connection]
ur5us has joined #zig
<andrewrk> wilsonk, yeah I'm looking forward to doing a stream to celebrate #6250 landing and give a little tour of how the whole thing works
<andrewrk> mkchan, ^
<fengb> Is it an internal restructuring where we won't notice it happening?
<andrewrk> mostly. I'm going to break some obscure things
<andrewrk> there will probably be a few regressions, for which fixing will then be in zig code instead of c++ :)
<wilsonk> nice
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
<pixelherodev> In other words, c++ is going to a nice little server farm upstate.
ur5us has quit [Ping timeout: 244 seconds]
<andrewrk> with the merge of #6250 it will finally be time to `mv src-self-hosted src` :-o
* pixelherodev claps enthusiastically
<pixelherodev> Sorry for my absence lately, been busy finishing up the move (so. much. to. organize. gahhh) and with uni :(
<pixelherodev> I'm hoping to resume work on CBE + SPU II in a week or two once I've had time to gain on my schedule a bit
<andrewrk> it's honestly been pretty good timing, because I've been working tirelessly on this monster branch that is guaranteed to massively conflict with anyone else's stage2 work
<pixelherodev> lol, yeah.
<pixelherodev> That's one reason I was eager to pick up the ZBS work earlier
<pixelherodev> Small (not a big time sink), and not actually part of stage2 :P
marnix has quit [Ping timeout: 272 seconds]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
<andrewrk> I've really been pushing myself, gonna need to take a break after this
<pixelherodev> You've *more* than earned it
<pixelherodev> I mean, wow.
msingle has quit [Ping timeout: 240 seconds]
<nikki93> it's really nice that when you gotodef of std stuff (eg. `AutoHashMap`) you can just scroll down and look at the tests
<nikki93> the basic test often teaches how the data structure works and the rest show some invariants etc.
<andrewrk> :)
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
cole-h has joined #zig
dch has quit [Ping timeout: 240 seconds]
JimRM has quit [Ping timeout: 244 seconds]
karrick has quit [Ping timeout: 260 seconds]
dputtick has quit [Ping timeout: 260 seconds]
lqd has quit [Ping timeout: 260 seconds]
tracernz has quit [Ping timeout: 240 seconds]
JimRM has joined #zig
lqd has joined #zig
karrick has joined #zig
strmpnk has quit [Ping timeout: 244 seconds]
jzelinskie has quit [Ping timeout: 260 seconds]
dch has joined #zig
tracernz has joined #zig
jzelinskie has joined #zig
dputtick has joined #zig
strmpnk has joined #zig
oxymoron93 has joined #zig
xd1le has quit [Read error: Connection reset by peer]
xd1le has joined #zig
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
radgeRayden has quit [Remote host closed the connection]
cole-h has quit [Quit: Goodbye]
lunamn has quit [Read error: Connection reset by peer]
lunamn has joined #zig
xd1le has quit [Read error: Connection reset by peer]
ur5us has joined #zig
return0e[m] has quit [Quit: killed]
alva has quit [Quit: killed]
bfredl has quit [Quit: killed]
Nypsie[m] has quit [Quit: killed]
protheory8-new-m has quit [Quit: killed]
juanfra__ has quit [Quit: killed]
BaroqueLarouche has quit [Quit: killed]
Snektron has quit [Quit: killed]
alexnask[m] has quit [Quit: killed]
xd1le has joined #zig
zannzen[m] has quit [Quit: killed]
Bastian[m] has quit [Quit: killed]
ifreund_ has quit [Quit: killed]
aterius has quit [Quit: killed]
fengb has quit [Quit: killed]
dermetfan has joined #zig
Nypsie[m] has joined #zig
Nypsie[m] has quit [Remote host closed the connection]
ifreund_ has joined #zig
juanfra__ has joined #zig
dtz has joined #zig
alexnask[m] has joined #zig
bfredl has joined #zig
return0e[m] has joined #zig
aterius has joined #zig
alva has joined #zig
protheory8-new-m has joined #zig
Snektron has joined #zig
Bastian[m] has joined #zig
BaroqueLarouche has joined #zig
fengb has joined #zig
Nypsie[m] has joined #zig
ur5us has quit [Ping timeout: 244 seconds]
ask6155 has joined #zig
<ask6155> Hello! I remember there being a page about editor support... can someone give me a link to it?
<Nypsie[m]> Don't think there is actually. Most syntax highlighters for different editors are however hosted under ziglang: https://github.com/ziglang
<Nypsie[m]> Perhaps you could tell us the specific editor support you're looking for? There's also support for some editors which are not listed in either
<ifreund> if you're asking about fancy LSP stuff, there is zls
marnix has joined #zig
ask6155 has quit [Ping timeout: 272 seconds]
ask6155 has joined #zig
dtz has left #zig ["Kicked by @appservice-irc:matrix.org : Idle for 30+ days"]
marnix has quit [Read error: Connection reset by peer]
jjsullivan has quit [Quit: Leaving]
jjsullivan has joined #zig
<ask6155> How do I make true to false and false to true? like a not?
<ask6155> something like x = not x
<jjsullivan> ask6155, just the `!` operator https://ziglang.org/documentation/master/#Table-of-Operators
<jjsullivan> **unary operator
<rain1> hello!
<jjsullivan> HELLO FREN
<rain1> :)
<jjsullivan> protip: don't wait on learning about ccache until you find out llvm exists
<jjsullivan> :^) my life has changed
<ask6155> I just have a bad computer so I just searched for how to speed up compilation and I found it.
<jjsullivan> yeah, it wasn't so much advice rather than my troubles building llvm many times
<jjsullivan> been so long since I touched real compiled languages
<jjsullivan> or had more than some homework to do
<ask6155> welcome back! nothing much has changed... only now we have safer c++ and better c
<jjsullivan> doesn't really seem like they changed all that much
<jjsullivan> templates/concepts in c++ are pretty cool though
<jjsullivan> but pale in comparison to the type computation in zig :^)
layneson has joined #zig
ask6155 has quit [Ping timeout: 246 seconds]
ask6155 has joined #zig
layneson has quit [Ping timeout: 260 seconds]
<ask6155> why is readAll not taking my buffer? it says it need []u8 but it got [1024]u8
g_w1 has joined #zig
ask6155 has quit [Ping timeout: 240 seconds]
ask6155 has joined #zig
<ask6155> oof
<Nypsie[m]> Use &buffer
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
<ask6155> If number is the value of a number, &number is the address of the number, then what is buffer is this scenario?
<Nypsie[m]> address of your array
<ask6155> if buffer is the address of my array then what is &buffer?
<Nypsie[m]> You have to pass a slice into the readAll() function
<Nypsie[m]> buffer was just an example for whatever you named your buffer...
<ask6155> I don't understand slices is there a tutorial on them somewhere?
earnestly has joined #zig
<ask6155> Do I always have to make slices from arrays?
<Michcioperz> for functions that take slices
<ask6155> okay
<Michcioperz> it would be hard to make most of these functions accept arrays because the size of an array is part of the type definition and has to be known at compile-time
xd1le has quit [Remote host closed the connection]
marnix has joined #zig
ask6155 has quit [Ping timeout: 264 seconds]
marnix has quit [Read error: Connection reset by peer]
ask6155 has joined #zig
waleee-cl has joined #zig
ask6155 has quit [Client Quit]
xd1le has joined #zig
Yardanico has joined #zig
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
msingle has joined #zig
oxymoron93 has left #zig [#zig]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
<ifreund> also you don't want to pass the array by value, you want to pass a pointer to the array
mokafolio has quit [Quit: Bye Bye!]
mokafolio has joined #zig
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
xackus has joined #zig
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
WilhelmVonWeiner has quit [Read error: Connection reset by peer]
xackus has quit [Ping timeout: 264 seconds]
decentpenguin has joined #zig
Stephanie is now known as Stephie
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
Akuli has joined #zig
blinghound has joined #zig
blinghound has quit [Remote host closed the connection]
WilhelmVonWeiner has joined #zig
marnix has quit [Ping timeout: 256 seconds]
marnix has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
gazler_ is now known as gazler
cole-h has joined #zig
dermetfan has quit [Ping timeout: 244 seconds]
decentpenguin has quit [Quit: ZNC crashed or something]
ifreund has quit [Ping timeout: 246 seconds]
ifreund has joined #zig
ifreund has quit [Ping timeout: 260 seconds]
pangey__ has joined #zig
pangey has quit [Ping timeout: 272 seconds]
frett27 has joined #zig
codemessiah has joined #zig
ifreund has joined #zig
<frett27> Hi community, i'm writing an iot deamon, as i'm learning zig, i'd like to have external opinion on review on the produced code. Are there any nice guys to have look and make some advises to make it much more idiomatic ? https://github.com/mqttiotstuff/iotmonitor/tree/develop thank you
<frett27> i would like to communicate much about it as my testing phase reached quite a stable usage for months
a_chou has joined #zig
a_chou has quit [Remote host closed the connection]
<wilsonk> frett27: looks interesting...I am probably not the one that should comment further but I just wanted to let you know someone is here :) It might be a little while before someone has time to look at that, but hang in there, the community is usually pretty good with requests like this
<frett27> hi wilsonk, thank's for the ping, yep the channel seems very quite
<frett27> there are no strong commitments, but wanted to give the best for this
<frett27> i know there is the 0.7 on stage, as soon as the llvm commit the 11
<frett27> and zig show time tomorrow :-)
<ifreund> I haven't noticed anything glaringly amiss, but the camelCase variable names did throw me off
<ifreund> looks like a neat project
<frett27> ifreund thank's, i'm committed on this
<frett27> and for my personal usage found it usefull
<ifreund> not a fan of underscores I guess? :P
<frett27> in names ? or _ = ....
<ifreund> i'm talking about snake_case vs camelCase for variable names still
<frett27> got it
<ifreund> hmm, the allocator handling in iotmonitor.zig also feels a bit strange
<ifreund> why not just init the gloabal to std.heap.c_allocator?
<frett27> was using the c_allocator to be able to benefit from valgrind
<frett27> as there are c mqtt and leveldb c lib also
<ifreund> well yeah if you're linking libc the c allocator is pretty much the thing to use
<ifreund> but your globabl is initialized to undefined here: https://github.com/mqttiotstuff/iotmonitor/blob/develop/iotmonitor.zig#L379
<ifreund> and then you use an arena as the global in one of the tests, which seems a little strange
<frett27> sorry the allocator it inited on the main's first line
<frett27> i may have allocated it in the declaration also
<ifreund> yeah, I see that but I'm saying it's confusing and unecessary when you can just do `const globalAllocator = std.heap.c_allocator;`
<ifreund> I prefer to call the const gpa though, as only general purpose allocators make sense to be global in most cases
<frett27> i got the point, maybe i wanted to have it previously "var" to benchother ones, but as soon as, the c makes sense, you got the point
xd1le has quit [Remote host closed the connection]
<frett27> thank's for the feedback, ifreund
<ifreund> no problem, though it was fairly superficial
<justin_smith> using a c lib that returns a [*c]const u8, how do I get print to print that string instead of u8@19c41788
<justin_smith> I'm doing "print("assigned name '{}'\n", .{p});"
<justin_smith> never mind, the trick was [*:0]const u8 instead of [*c]const u8
<justin_smith> it's fun that the compiler's that smart
<ifreund> justin_smith: you could also to print("{s}\n", .{p});
<ifreund> see the doc comment in std.fmt, it's quite informative
<ifreund> s/to/do/
ur5us has joined #zig
<justin_smith> oh, great, thanks
<justin_smith> in this case [*:0]const u8 is a better description of the pointer, given the API
<justin_smith> but that's a good trick for other situations
<andrewrk> justin_smith, generally, [*c] is only to be used by auto translated code. if you're denoting the type by pressing keys into your keyboard, you should pick the actual memory layout instead of leaving it ambiguous
<justin_smith> this was the last bug in my verbatim "translate-c" based port of the jack example client (the simple one that copies the microphone data to the speaker), I'm going to see if I can clean it up more, make a blog post, and most likely turn it into a more generic "drop you zig function in here to process audio" example
<justin_smith> andrewrk: that's a great rule of thumb, thanks, yeah I did start with translate-c, and I'm trying to turn it into better code
<justin_smith> I'll make a goal of turning every [*c] into something more specific
<ifreund> I for one love classifying those [*c] pointers
<ifreund> it's so satisfying to fit them into zig's superior pointer type system
<justin_smith> ifreund: what's the best guide - the #Pointers secion in the langref, or?
<ifreund> That's all I've used, it certainly has everything you need
<frett27> lang ref, for sure, and there is a ziglearn initiative : https://ziglearn.org/chapter-4/#c-pointers
<justin_smith> frett27: cool, that's new to me thanks
<ifreund> if you have any specific case where it's unclear to you what the type should be, feel free to ask here of course
AlbinoDrought has quit [Ping timeout: 256 seconds]
AlbinoDrought has joined #zig
<pixelherodev> Hmm, here's an idea - for simpler translate-cs, does it make sense to have an interface which asks the user to disambiguate types?
<pixelherodev> That would be useful for long-term bindings / conversions which aren't intended to be regenerated frequently
xackus has joined #zig
<justin_smith> pixelherodev: well, it's easy enough to search for every "[*c]" in my file and know they all need fixing
<justin_smith> pixelherodev: the goal here was twofold, to make a blog post / example of translating a relatively straightforward c lib with a small api surface, and maybe ending up with a reusable binding spot for other code
marnix has quit [Ping timeout: 260 seconds]
marnix has joined #zig
<pixelherodev> justin_smith: yes, but that means one at a time
<pixelherodev> I meant so it asks for the fundamental type, and then propagates it
<pixelherodev> Maybe even replaces [*] with []
<justin_smith> right, but you'd want ? when its 0/1 vs. many
<justin_smith> and it could be that the same data type in the same api is 0/1 for one call, and many for another
Akuli has quit [Quit: Leaving]
<justin_smith> here's a fun example where multiple steps of translation can be elided entirely by using type inferernce and feeding c back what you got in the first place - runtime behavior is the same on each side of this diff http://ix.io/2y3x
<justin_smith> approach one: fix the alignment of the pointer, fix the type, cast back to what the c lib wants
<justin_smith> approach two: ignore alignment and type, and feed c the same garbage it fed you
<justin_smith> I probably will want a helper that takes a []c.jack_default_audio_sample_t and quietly turns it into void to hand it to jack
<justin_smith> just because c is gigo doesn't mean we need to deal in garbage :D
<ifreund> why the *% for copy_size there?
<justin_smith> ifreund: it was done by translate-c, my first guess is overflowing multiplication
<ifreund> ah, yeah well all unsigned multiplication in C is wrapping
marnix has quit [Ping timeout: 260 seconds]
<justin_smith> I replaced with * (and removed that @bitCast / @as combo) and the program compiles and behaves as before
<ifreund> * is what makes sense here yeah
<justin_smith> ifreund: yeah, sercing in langref.html gives "*% - wrapping multiplication, guaranteed to have two's complement wrapping behavior"
<justin_smith> so it looks like a corner case c undefined behavior thing
<justin_smith> I'm developing this by running the program repeatedly, and since it pipes mic to speaker, I rub the laptop mic to test
<ifreund> yes, *% is the proper translation of * for unsigned ints in C
<justin_smith> this makes the dogs jealous because I am "petting the laptop"
<ifreund> hah
<justin_smith> so petting dogs is now part of my dev iteration lol
<justin_smith> if only I had a contact mic in a dog brush :D
<gonz_> We should all have this
ur5us has quit [Quit: Leaving]
layneson has joined #zig
drvirgilio has quit [Quit: No Ping reply in 180 seconds.]
drvirgilio has joined #zig
marnix has joined #zig
<andrewrk> lol
layneson has quit [Ping timeout: 260 seconds]
<frett27> :-
<frett27> petting dogs checks the unsigned int overflow lol
<frett27> s/dogs/laptop/
<pixelherodev> andrewrk: I disable github notifications for the foreseeable future, since I was getting too many of them; mind pinging me in here when 6250 is merged so I don't obsessively check?
<andrewrk> sure
<andrewrk> pixelherodev, you may also be interested in https://github.com/ziglang/zig/issues/6378
frett27 has quit [Ping timeout: 272 seconds]
<pixelherodev> Hmm.
<pixelherodev> Hmmmmmm.
<pixelherodev> I think I like it.
<pixelherodev> The only real concern to me is that I don't know how many people will be motivated to touch that stage1 output from CBE, but that's been a sorta back-of-the-mind concern for a bit now
<pixelherodev> It does make sense to me that bootstrapping shouldn't be a priority for now
<andrewrk> I can do that work, I don't mind one-off monotonous code massaging
<andrewrk> that might be my greatest strength, honestly
<ifreund> with a good text editor and music it can be fairly pleasant
<pixelherodev> :P
marnix has quit [Ping timeout: 258 seconds]
msingle has quit [Ping timeout: 260 seconds]
tdeo has quit [Read error: Connection reset by peer]
tdeo has joined #zig
squeek502 has quit [Quit: Leaving]
pangey has joined #zig
pangey__ has quit [Ping timeout: 264 seconds]
squeek502 has joined #zig
dermetfan has joined #zig
xackus has quit [Ping timeout: 240 seconds]