blinghound has quit [Remote host closed the connection]
doublex has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
pangey has quit [Ping timeout: 260 seconds]
craigo has quit [Ping timeout: 264 seconds]
_whitelogger has joined #zig
rzezeski has joined #zig
CodeSpelunker has joined #zig
CodeSpelunker has quit [Quit: CodeSpelunker]
CodeSpelunker has joined #zig
nvmd has joined #zig
CodeSpelunker has quit [Quit: CodeSpelunker]
<gruebite>
heh, may: while (var i: usize = 0) (i < 42) (i += 1) { ... }
<gruebite>
maybe*
<gruebite>
forgot the colons
craigo has joined #zig
<Kingsquee>
huh, interesting
<Kingsquee>
sokol_debugtext integrates some font data directly in its source code, and offers functions to initialize font structs with them
<Kingsquee>
when I try to do that via zig, it fails
<Kingsquee>
but when I port the raw font data into the zig source and do it manually, it works
<Kingsquee>
I wonder if the data's being optimized out or misaligned or something
<Kingsquee>
on the c side
craigo has quit [Remote host closed the connection]
craigo has joined #zig
<gruebite>
how was the c compiled?
<Kingsquee>
sokol.c compiled through build.zig
<Kingsquee>
addIncludeDir and addCSourceFile
pmwhite has quit [Ping timeout: 240 seconds]
<pixelherodev>
Ha, woot! all three Passed CI :D
<gruebite>
what is a good convention for allocation and returning something that needs to be freed? in C it's stricky too and requires documentation/naming convention
<gruebite>
if you're passing in an allocator you're probably expecting it to allocate and need freeing
<gruebite>
but not necessarily
<pixelherodev>
I use h_
rzezeski has quit [Quit: Connection closed for inactivity]
<antaoiseach>
Do we have the equivalent of limits.h in Zig? I searched the stdlib, but couldn't find anything close - only floating point max/min in math.zig
<pixelherodev>
Recursive detection of .c files in src/ ;)
<daurnimator>
make sure you read the Etymology section
<ikskuh>
nice
<ifreund>
heh
Ashpool_ has joined #zig
<Ristovski>
this is interesting. When using cimguis `c.igText("%.3f", io.*.Framerate);` the value is always zero, however if I print it with std.debug.print it works just fine
<Ristovski>
or rather, it doesn't update
Ashpool__ has quit [Ping timeout: 264 seconds]
<ikskuh>
s Framerate a f64 or f32?
<ikskuh>
maybe you need to expand it to f64 first?
<Ristovski>
I think it's f32
<alexnask[m]>
Doesnt `%f` apply to both float and double? (at least in stdio). Though idk how the printf/w.e. implementation figures out what it is
<Ristovski>
oh wait, ikskuh you are right
<Ristovski>
@as(f64, io.*.Framerate) works
<ikskuh>
congratulation, Ristovski. you discovered a bug!
<ikskuh>
codegen bug even
<Ristovski>
@as(f64, io.*.Framerate) works
<Ristovski>
whoops
<ikskuh>
alexnask[m]: "..." is enforcing widing types from … to int or double
<ikskuh>
except when the type is larger
<alexnask[m]>
huh, TIL
<ikskuh>
"%f" only takes doubles, when you pass a float, it gets widened
<ikskuh>
same mistake is in the lite-c compilre btw
<ikskuh>
that's how i knew it could be this :D
<ikskuh>
i ran into the same trap a long time ago
<Ristovski>
Oh, TIL as well
<ikskuh>
i don't know the exact rules, but passing stuff into a C "..." has special rules
<alexnask[m]>
Yeah looks like "default argument promotions" happen for varargs (integer promotions + float -> double)
<alexnask[m]>
(was wondering if it was implementation defined or smth but no, these promotions happen when no prototype is present and for varargs)
<ikskuh>
yay
<ikskuh>
C is nice.
<ikskuh>
:D
<Ristovski>
hmm, interesting, when doing c.printf("%f", 3.0) I get "TODO: support C ABI for more targets" even tho "pointers, integers, floats, bools, and enums work on all targets"
<Ristovski>
happens with an integer as well
<ikskuh>
yep
<ikskuh>
that's because you're passing a comptime_float and comptime_int
<Ristovski>
ah, that makes sense
bsrd has joined #zig
xackus_ has joined #zig
<Ristovski>
Hmm, how hard would it be to make std.debug.print pretty print structs for example? (pretty print == format them across multiple lines, with indentation)
<Ristovski>
I should clarify - C structs
<daurnimator>
Ristovski: does it not already?
<alexnask[m]>
Does std.fmt do pretty printing? I thought it just printed all in one line
<Ristovski>
alexnask[m]: It prints all in one line
<Ristovski>
Hmm, this could actually be done if I could somehow loop over the C struct members
<alexnask[m]>
I guess there could be a format specifier to do it but honestly I would just write a mixin that provides a pretty printing format fn
<ifreund>
shouldn't be too annoying to resolve either way
<pixelherodev>
If it is, it's my own fault for not getting mine in sooner
<ifreund>
why can I not find anything about wasm32 vs wasm64 in the spec
<pixelherodev>
Because the spec sucks?
<ifreund>
either that or I'm missing something
<ifreund>
ah, it seems that wasm64 may not actually be a thing yet
<ifreund>
which would make sense as the spec uses 32 bit addresses everywhere
dermetfan has joined #zig
<pixelherodev>
Ah right, I actually knew that ifreund
<pixelherodev>
Because when I was SPU II backending early on, I triggered a "WASM64 is not yet supported" because it thought spu_ii == wasm64 for a bit lol
<ifreund>
lol
pmwhite has joined #zig
waleee-cl has joined #zig
riba has joined #zig
wootehfoot has joined #zig
riba has quit [Ping timeout: 240 seconds]
<pixelherodev>
ifreund: nice work!
<pixelherodev>
(5974)
<ifreund>
thanks, I just did what seemed to need doing :)
<pixelherodev>
That's what we've all been doing :)
mattmurr has joined #zig
<ifreund>
well, looks like there's no way to access globals in wasm with indirection
<ifreund>
guess only functions will be incrementally complied
<ifreund>
accesing fields of a non-extern zig struct from C would be UB
<gruebite>
but i also see a benefit to writing zig and exposing it as C
<pixelherodev>
Vexu wrote a scripting language? Neat
<leeward>
zigusr: You might want to look into @Type(.Opaque).
<leeward>
gruebite: Tons of benefit, it's just that the corpus of Zig code isn't that big yet and it tends to be focused on writing Zig instead of writing C libraries in Zig.
<zigusr>
I want to convert some cython code I have to zig
<alexnask[m]>
Yeah bog looks pretty good Ill def use it if I ever need a smal lscripting thing in a zig program
<gruebite>
yeah
<gruebite>
zig ecosystem could grow more
<gruebite>
i'm making stuff :)
<leeward>
Well, the language isn't even stable yet. It's early days.
<gruebite>
yeah
<pixelherodev>
andrewrk: that PR does three things: debug.warn -> debug.print; removes a redundant parameter from runOneCase; refactors runOneCase's Execution branch to not try running tests natively when cross-compiling
<gruebite>
for me i'm already seeing huge benefits using zig, so the instability is a tradeoff i'm accepting
<ifreund>
same, zig makes things a lot nicer
<pixelherodev>
Most of us agree :)
<leeward>
selection bias being what it is
<pixelherodev>
Exactly
<pixelherodev>
wouldn't be here if we didn't
<pixelherodev>
Wouldn't be active at least
<pixelherodev>
I lurk in channels of stuff I don't use :P
<gruebite>
hahaha same
<pixelherodev>
If I find it interesting enough
<andrewrk>
ifreund, I'll push my ULEB128 commit
<zigusr>
how does zig lang compare to v lang ? :0
<ifreund>
andrewrk: cool, I already pulled and rebased onto it so it's not really blocking me atm
CodeSpelunker has quit [Quit: CodeSpelunker]
<andrewrk>
ok cool
<andrewrk>
ifreund, I like how git lets you cherry pick a commit like that, and then later when you rebase it will just delete it :)
<leeward>
"$2 = <optimized out>" :(
<ifreund>
yeah git is really awesome
<andrewrk>
leeward, in stage2 that would be a bug in zig code instead of llvm code :)
<leeward>
andrewrk: \o/
<leeward>
I said -O0, dammit!
<ifreund>
what is currently blocking me is the design work around making wasm incremental compilation work well, but I'm slowly figuring things out
<andrewrk>
ifreund, it took me several days of not coding and scribbling in notebooks to figure out how to do incremental compilation for ELF, so take your time :)
<ifreund>
binary size is not going to be anywhere near optimal for incrementally compiled debug builds though
<andrewrk>
of course, that's to be expected
<andrewrk>
consider that the work flow for someone using incremental compilation debug builds is testing on their own computer
<ifreund>
yeah
<gruebite>
will incremental builds be optional?
<ifreund>
I'm going to be putting a fair amount of padding in the file too in order to avoid copying sections around all the time
<leeward>
They should be turned off with --release-*
<pixelherodev>
Should be optional for debug too IMO
<pixelherodev>
`--no-incremental` or something
<andrewrk>
it's possible. I won't promise it, but likely the code needed for --release* builds to work could be reused for non-incremental debug builds as well
<andrewrk>
ifreund, makes sense. I'm about to do the same with the line number program debug info
<pixelherodev>
Or we could rename debug -> development and release-safe -> release-debug ?
<gruebite>
might be a lot to support. what's the usecase for --no-incremental during debug builds?
<pixelherodev>
Maybe we should replace release *modes* with release *specifiers*
<fengb>
Maybe split the mode like we did CPU features
<leeward>
I wouldn't mind a release-small-safe, but safe and small are opposed goals so it won't bother me too much if we don't get it.
<Sahnvour>
ideally we'd split the mode into debug features enabled or not
<ifreund>
andrewrk: I did give it a read and it helped me get in the right mode of thought for this design work, but wasm is different enough that it's not really applicable
<andrewrk>
leeward, we have `--release-safe --strip` for non-debuggable safe release builds
<pixelherodev>
DOsOf => debug symbols, optimized for speed and size, no safety checks
<pixelherodev>
OfS => optimized for speed, no debug symbols, safety checks
<pixelherodev>
etc
<leeward>
I guess that works.
<pixelherodev>
(probably a better way to specify it)
<ifreund>
does wasm have some concept of debugging symbols like dwarf?
<ifreund>
i sure hope not :P
<fengb>
They sorta added dwarf
<andrewrk>
ifreund, makes sense. hmm maybe look up "source maps"
<fengb>
I think it’s just a Chrome custom thing atm
<pixelherodev>
Most webshit starts as custom Chrome things lol
<andrewrk>
ifreund, I've been feeling good about designing by starting with the memory layout. E.g. what fields will be in memory for each Decl, for each Fn, for each File, etc
<zigusr>
how do i get libc in windows buidls ?
<pixelherodev>
WebSerial, WebUSB, Web*...
<andrewrk>
once that all makes sense in your head, it takes a while, but the other pieces will fall into place
<pixelherodev>
zigusr: uhhh... -gnu?
<pixelherodev>
I think that uses mingw
<fengb>
Google wants to push web “standards”
<zigusr>
can i use msvcrt ?
<andrewrk>
I think this is what "data oriented design" means
<pixelherodev>
fengb: yeah, exactly
<alexnask[m]>
zigusr: `-lc` will autodetect msvc and link to it
<zigusr>
k, tnx
<zigusr>
is that documented anywhere?
<leeward>
pixelherodev: I think if we break out all the composable bits, the best way to spell it is "--release-safe" means "--safe -Ofast", "--release-fast" means "--unsafe -Ofast --strip", etc.
<fengb>
-O2 >_>
<ifreund>
andrewrk: Yeah, I've also been working memory-first so far, it makes a lot of sense for this kind of stuff
<pixelherodev>
leeward: yeah, exactly
<pixelherodev>
fengb: We don't have optimization levels
<pixelherodev>
Might be better to use -Ospeed -Osize
<Sahnvour>
andrewrk: exactly, know the data and design the processing around it :)
<pixelherodev>
To avoid confusion with GCC / Clang one
<pixelherodev>
ones*
<pixelherodev>
the*
nikita` has joined #zig
<alexnask[m]>
zigusr: Not sure if the native libc detection is documented
<leeward>
GCC supports -Ofast.
<fengb>
Oh it does? That’d match at least
<leeward>
-O0 -O1 -O2 -O3 -Os -Ofast -Og
<pixelherodev>
leeward: that's why I said -Ospeed instead of -Ofast
<pixelherodev>
-Ofast on GCC is a no-no
<pixelherodev>
It *trades conformance* for speed
<leeward>
Pfft, conformance.
<pixelherodev>
--release-fast doesn't do that
<fengb>
Oh really?
<pixelherodev>
-Ofast includes -ffast-math
<fengb>
Wait why would a compiler break conformance?
<ifreund>
hmm, I don't think I'm going to put time into debug info for wasm yet. Nothing is standardized
<andrewrk>
that sounds completely reasonable
<pixelherodev>
Agreed
<fengb>
MVP
<Snektron>
<fengb "Wait why would a compiler break "> Well for example strictly x+x is different from 2*x for floats
<Snektron>
It yields a different result
<Snektron>
Yet those operations might have different performance implications
<leeward>
exponent++
<leeward>
not always correct
<leeward>
?
<ifreund>
pixelherodev: "Note that this also moves allocator and file from File.ELF and File.C into File" You should really put stuff like this in a separate commit tbh
<pixelherodev>
I *know*
<pixelherodev>
ifreund: I'm splitting commits for test harness PR rn
<andrewrk>
pixelherodev, i'd like to focus on just 1 PR from you at a time
<pixelherodev>
andrewrk: does it matter to you if I split the ones in ELF as well?
<pixelherodev>
That's fine
<andrewrk>
gave you an ihex review
<pixelherodev>
I saw
<pixelherodev>
aerc in another tmux tab, got notified nearly immediately ;)
<andrewrk>
if you look at the way the zig project uses ELF, it's a similar situation. we actually duplicate reading/writing ELF things in quite a few places. sometimes it's appropriate to avoid too-high-level abstractions
<andrewrk>
the great thing about a frozen spec like ELF or IHEX, is that it becomes more OK to duplicate code that relies on the details of the spec
<andrewrk>
of course things like constants can be abstracted at no cost, but others are inherently coupled with the surrounding code
<andrewrk>
I'm vetoing the callback thing
<pixelherodev>
Gotcha, will update soon
<pixelherodev>
Finishing up the test harness split now
<pixelherodev>
just running tests to ensure commits are properly self-contained
<andrewrk>
ok. I'm looking at your oldest PR only until it is closed or merged before moving on
<pixelherodev>
Fair
<pixelherodev>
On the bright side, that gives CI time to finish ;pl;
<pixelherodev>
lol*
<gruebite>
top level constants, lower or uppercase?
<andrewrk>
pixelherodev, the art of upstreaming big changes is its own skill, but I promise you it will be worthwhile in your career
<pixelherodev>
I know :)
<pixelherodev>
Hopefully ZSF gets an anonymous billionaire sponsor and Zig *becomes* that career ;P
<andrewrk>
ok your oldest PR is now ihex. your move :)
<pixelherodev>
andrewrk: any issues with just removing the callback and having it return the data structure?
<pixelherodev>
That makes the most sense to me
<pixelherodev>
`while (true) { record = parse(); // use record }` instead of `while true { parse(handleRecord); }`
<pixelherodev>
(removing the loop from within `parse`)
<andrewrk>
idk, that PR kinda seems out of place to me. I suggest to close it for now and focus on one of the other two
<pixelherodev>
Sure
<pixelherodev>
Makes sense
<pixelherodev>
That makes ELF the oldest I think
<pixelherodev>
andrewrk: *your* move now ;)
<pixelherodev>
If only I could send patches from a non-GitHub repo to Zig :(
<pixelherodev>
that's unrelated though
<andrewrk>
damn it looks like we're even going to have incremental compilation and debug info for SPU Mk II ? that's pretty slick
Ashpool has quit [Quit: Leaving]
<pixelherodev>
Eventually, yes
<andrewrk>
pixelherodev, for future reference it really helps to explain when you add big stuff like this address space thing
<pixelherodev>
For sure, yeah
<pixelherodev>
i'll make sure to do that in the future
<pixelherodev>
Note that debug info will require an emulator that understands it
<pixelherodev>
But there's no reason I couldn't do that for my Tricarbon JIT for instance
<pixelherodev>
On that note, need to work on my backend rewrite :)
<pixelherodev>
I'll wait for PR comments before proceeding probably
factormystic has quit [Read error: Connection reset by peer]
* pixelherodev
facepalms
<pixelherodev>
Thought I'd closed it
<pixelherodev>
andrewrk: okay, your turn :)
* pixelherodev
facepalms
<pixelherodev>
I closed the wrong one
<alexnask[m]>
lol
nvmd has quit [Quit: Later nerds.]
dermetfan has joined #zig
<pixelherodev>
Okay, my turn again :)
<andrewrk>
now it's my turn to code :)
<Snektron>
Pair programming?
<andrewrk>
no, I was just spending a few hours doing code reviews
<pixelherodev>
:P
<andrewrk>
that was my gentle way of saying, "I'm going to ignore you for a few hours"
<pixelherodev>
Don't worry, I'll ignore you too!
factormystic has joined #zig
<pixelherodev>
Biggest use case for CBE focus: it'd allow for easily using the Zig test suite system with C code easily
<pixelherodev>
and there's not a single good C test system
<pixelherodev>
Whoa!
<pixelherodev>
Kristall properly highlights code in HTML??
<leeward>
pixelherodev: I don't know about there not being a single good C test system. That's a difficult claim to prove.
stripedpajamas has joined #zig
<ifreund>
absolute claims generally are :D
<leeward>
Feels like the setup for the xkcd about standards.
<pixelherodev>
I mean... yeah?
FireFox317 has quit [Ping timeout: 246 seconds]
<companion_cube>
is spu mk2 a real thing? can you get a board for it?!
<Snektron>
Just a thought really, but it seems keyword pollution to introduce those things for shaders, especially since there are quite a lot of options
<andrewrk>
I could see that making sense
<Snektron>
Plus, there might be other architectures which require specific attributes... This way, they can be added without breaking problems