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/
<scientes> so has it been decided that varargs are to be removed?
<scientes> cause i just found out they are buggy
<daurnimator> they shouldn't be; they're a required part of C interop
<scientes> oh yes
<scientes> actually that works
<scientes> its just that you can't use fastcc with var args
<daurnimator> yeah I saw your issue.
<scientes> now i gotta figure out how to print a float without var args....
<scientes> can i call sizeOf from the compiler?
<scientes> oh of course i can
<scientes> i just have to insert it into llvm first...
<tgschultz> it is weird that the compiler can't infer my error set, but can verify that an explicit error set is correct...
hio has quit [Quit: Connection closed for inactivity]
marijnfs_ has joined #zig
marijnfs has quit [Ping timeout: 244 seconds]
Summertime2 is now known as Summertime
<emekankurumeh[m]> imo error sets are nice in theory, but they are quite broken in implementation
mrkishi has quit [Read error: Connection reset by peer]
mrkishi has joined #zig
knebulae has quit [Read error: Connection reset by peer]
porky11 has joined #zig
<daurnimator> huh. writing python just then I started wishing for zig-style error handling
Ichorio has joined #zig
Ichorio has quit [Ping timeout: 250 seconds]
<marijnfs_> whats brokeen about it
mrkishi has quit [Ping timeout: 252 seconds]
hio has joined #zig
<mq32> heyhoh :)
<mq32> is it possible to create a link-time-optimization-objectfile with zig?
<mq32> i would like to integrate some zig code in my C++-Project, but i don't want to lose LTO optimization for the zig code
<mq32> example: https://godbolt.org/z/kcWVRc the lut_sine function should be inlined over object file boundaries
<SamTebbs33> Can you create an object file with Zig the link it with your C++ objects with LTO enabled?
<SamTebbs33> then link*
<SamTebbs33> LTO is done at link time so it's managed by the LLVM linker under-the-hood (AFAIK)
<mq32> SamTebbs33, i somehow have to pass "-flto" to the code generator
<mq32> LTO object files are not the same format as non-LTO object files
porky11 has quit [Quit: Leaving]
<SamTebbs33> Then I'm not sure, one of the more experienced zig contributors will have to help you there
<SamTebbs33> You may be able to do it by supplying a different build mode: https://github.com/ziglang/zig/issues/531#issuecomment-335755921
<mq32> nah, the build mode should be the same (featurewise) for LTO and non-lto
<mq32> maybe andrewrk knows more?
<BitPuffin> anyone know why when a C library calls vprintf the program segfaults?
<BitPuffin> I linked libc
<BitPuffin> maybe stdout isn't open or something?
<SamTebbs33> Are you giving the library bad input?
<BitPuffin> it doesn't seem like it no
<BitPuffin> it's raylib
<BitPuffin> so I'm doing raylib.InitWindow(1280, 720, c"hello");
<BitPuffin> hmm well it segfaults even when I try to use printf
<SamTebbs33> Hmm, see if you can reproduce it without raylib, if not then perhaps it could be an issue with how Zig links with libc or raylib
<BitPuffin> hmm it works without
<BitPuffin> hmm so c printf works, but if I actually call raylibs init function, then also printf stops working
lygaret has joined #zig
mrkishi has joined #zig
<SamTebbs33> I'm gonna guess it's an issue with raylib then
halosghost has joined #zig
lygaret has quit [Ping timeout: 248 seconds]
<BitPuffin> yeah or at least the combination of zig and raylib
<BitPuffin> since it probably works in C
<SamTebbs33> How are you linking raylib with your zig code?
<BitPuffin> just exe.linkSystemLibrary("raylib"); in the build.zig
<BitPuffin> hmm maybe I'm not linking to all the dependencies
<BitPuffin> didn't seem to change anything
porky11 has joined #zig
<BitPuffin> Hmm so looking at how raylib calls the vprintf
<BitPuffin> It doesn't seem to do anything particularly spooky
<BitPuffin> But a possible workaround I see is to disable support for tracelog
knebulae has joined #zig
<BitPuffin> Are there any known issues with calling c libraries that use va_list or something?
<andrewrk> BitPuffin, zig doesn't (yet? ever?) have any compiler warnings/errors for C printf - they would have to be hard coded
<andrewrk> you'll want to carefully double check that your % and your args agree with each other
<SamTebbs33> There was a discussion in a GitHub ticket about c libraries and va_list, I'll see if I can dig it out
<SamTebbs33> I can't guarantee it will have anything of value though
<andrewrk> does a debugger give any clues? valgrind?
Akuli has joined #zig
FireFox317 has joined #zig
<FireFox317> Hey guys, if I want to add code to a PR that is already merged should I add a new PR or can I reuse the merged PR somehow?
<andrewrk> FireFox317, new PR
<FireFox317> I already created the new PR btw
<FireFox317> Okay thankyou!
<andrewrk> I'll have a look in a couple hours. I'm going to be a bit quiet on the issue tracker for a while as I focus on https://github.com/ziglang/zig/pull/2602
<FireFox317> andrewrk: I would like to work a bit on the compiler, is there any particular issue that I can focus on or should I just pick on in the contributer list?
<SamTebbs33> Look out for issues labeled with "contributor friendly"
<FireFox317> 'contributer friendly' list*
<SamTebbs33> ^
<andrewrk> FireFox317, you saw this doc, yeah? https://github.com/ziglang/zig/blob/master/CONTRIBUTING.md
avoidr has joined #zig
<FireFox317> SamTebbs33: Yes, that's why I mean :)
<BitPuffin> andrewrk: but this isn't me calling printf with unmatching args. This is me calling a C library that happens to log things with vprintf
<BitPuffin> So an external system library is being grumpy when called from zig
<FireFox317> andrewrk: Yes, I did actually, thanks for reminding me!
<BitPuffin> SamTebbs33: hmm you mean the one linked in the manual?
<BitPuffin> Anyway gdb didn't really give me anything helpful as far as I can decipher
<BitPuffin> Haven't tried valgrind
FireFox317_ has joined #zig
<andrewrk> BitPuffin, it looks like you don't have debug symbols for the code where the crash is happening. that's going to be tricky to solve
<BitPuffin> I compiled the library from source
<BitPuffin> So unless the build system is very annoying I can hopefully rebuild with debug symbols!
<andrewrk> debug symbols are on by default if you built the C code with zig
donpdonp has joined #zig
<BitPuffin> I was also considering just throwing it into the zig repo
<BitPuffin> So might as well go ahead and do that
<BitPuffin> But I'm not really sure how to use Zig build all that well
<andrewrk> that makes sense since it's not documented and unstable
FireFox317 has quit [Ping timeout: 256 seconds]
<andrewrk> BitPuffin, that's libc the crash is in btw
<BitPuffin> Yes
<BitPuffin> From vprintf no?
<BitPuffin> The internal
<andrewrk> what OS / libc is this?
<BitPuffin> Latest Ubuntu
<andrewrk> glibc? I wonder if https://github.com/ziglang/zig/pull/2509 is related
<BitPuffin> Some glibc
<BitPuffin> It certainly could be :)
<FireFox317_> Uhm, could someone with some git/github knowledge help me out? Somehow I ended up referencing some issues (i.e. #2046 and #514). I'm not sure if everybody sees this or if it is just me, but I would like to fix it somehow. `timonkruiper` is my github name. Should I just delete my fork and re-fork it, (still have a waiting PR tho), so that maybe doesn't work. Any help is appreciated
<andrewrk> FireFox317_, what's the problem?
<FireFox317_> Well, if you look at those issues mentioned, it shows that I reference them in my own fork (at the bottom of the issue). Maybe I only see this, then there is no problem, but it shouldn't be there.
<andrewrk> FireFox317_, don't sweat it, it's just a little bit of noise that people will have no problem ignoring. you can edit your github comments
<FireFox317_> andrewrk: Hmm okay. I somehow rebased my own copy and it added my name to some commits. I think that is why it is showing up as a reference in the main repo
<andrewrk> are you talking about #2621?
<BitPuffin> Hmm is there a repo somewhere with example of compiling C sources with zig
<BitPuffin> Nice
<BitPuffin> Is there a way to do some globbing
<SamTebbs33> *Leaving work so will log back in at home*
SamTebbs33 has quit [Quit: leaving]
<andrewrk> BitPuffin, you'd have to implement it yourself, but glob support is planned for the zig build system
<BitPuffin> Alright
<andrewrk> BitPuffin, you can also try -target x86_64-linux-musl and see if that solves the problem
<andrewrk> that would be a good clue
<BitPuffin> For now it's something that a little bit of keyboard macroing can't solve
<BitPuffin> Not can't solve
<BitPuffin> andrewrk: how is that done with build
<andrewrk> your_artifact.setTarget(.x86_64, .linux, .musl);
<FireFox317_> andrewrk: Well, it happened when I added that PR yes. But just to be clear, at the bottom of #2046 do you see the reference to my fork? Because that is a mistake from me
<mrkishi> we do. whenever you reference an issue in a commit message anywhere on github, it'll create a mention on the issue.
<andrewrk> FireFox317_, yes I see it. don't sweat it
<BitPuffin> hmm
<BitPuffin> how do I define C symbol
<donpdonp> has anyone done a writeup on building an osx .App/ from zig? especially tips like what to link to in the build.zig and what support files are needed in the .App/ folder
<BitPuffin> ahh I guess I can just pass it to the addCSourceFile derp
<andrewrk> BitPuffin, oh you meant -D args? yeah
<BitPuffin> yup
<andrewrk> alright I'm gonna go quiet now, need to focus on my core lang changes. will be on later
wilsonk has quit [Ping timeout: 245 seconds]
<BitPuffin> Hmm okay so I am now building raylib in zig
<BitPuffin> and now it works. Hooray....?
wilsonk has joined #zig
lunamn has quit [Quit: leaving]
<BitPuffin> if it is the glibc thing you mentioned, then I guess it makes sense if it works now that I build it with zig, cuz it's gonna link to the same one
<FireFox317_> I got rid of the references by deleting my fork and re-forking it :) Apparantly there were so called 'dangling' commits in my fork.
avoidr has quit [Quit: leaving]
wootehfoot has joined #zig
DesDeux has joined #zig
<BitPuffin> arrk, how do I add a file so that it can be imported directly without relative path in the build system
<BitPuffin> not command line
Zaab1t has joined #zig
<BitPuffin> tried using linkLibrary but norp
<BitPuffin> addPackagePath maybe
Zaab1t has quit [Quit: bye bye friends]
porky11 has quit [Ping timeout: 248 seconds]
<DesDeux> Hello, maybe someone can help, i've trying to import raylib headers with "const c = @cImport(@cInclude("raylib.h"));", but get "error: declaration shadows primitive type 'bool' pub const bool = extern enum {" . Tried solving this with including stdbool.h "@cInclude("stdbool.h");", wich results in ldd errors "lld: error: undefined symbol: ..." where ... is functions wich i've tried to call from raylib.h.
wilsonk has quit [Ping timeout: 245 seconds]
FireFox317_ has quit [Ping timeout: 256 seconds]
lunamn has joined #zig
wilsonk has joined #zig
porky11 has joined #zig
SamTebbs33 has joined #zig
Akuli has quit [Quit: Leaving]
Xe is now known as Cadey
<SamTebbs33> I have a nooby question: I have a function that takes a pointer to a struct, makes a pointer to a field within that struct, then attempts to change the fields in that pointer: https://gist.github.com/SamTebbs33/ccaccfc488491e24272f78f4f7a7f5fd
<SamTebbs33> But if I step through those lines in the function within GDB, the fields in the entry struct never change, what am I doing wrong?
avoidr has joined #zig
<SamTebbs33> I also tried assigning by dereferencing the pointer first but had no luck `(entry.*).four_megabyte_pages = true;`
DesDeux has quit [Quit: Leaving]
<mikdusan1> you might try a code reduction because i assure you, assigning to pointer.field works :)
<SamTebbs33> Yeah I imagined that it should work >.<
<SamTebbs33> I allocated the main struct with allocator.alignedAlloc, if that makes a difference :p :D
Ichorio has joined #zig
<SamTebbs33> Is that the correct way of getting a pointer to directory.entries[page] though?
<SamTebbs33> var entry: *DirectoryEntry = &dir.entries[page];
<emekankurumeh[m]> i think `++` should work on all strings at comptime
<emekankurumeh[m]> but that might lead to abuse though
<halosghost> … what would ++ even do on a string?
<halosghost> increment a pointer?
<emekankurumeh[m]> what do you mean?
<halosghost> are you talking about C-style pre/postfix ++ operator?
<emekankurumeh[m]> `++` in zig is array concatenation
<emekankurumeh[m]> there are no increment operators in zig other than `+=`
<halosghost> ahhhh
<halosghost> I misunderstood
<halosghost> fair enough
shodan45 has joined #zig
SamTebbs33 has quit [Quit: Lost terminal]
wootehfoot has quit [Read error: Connection reset by peer]
MajorLag has joined #zig
tgschultz has quit [Ping timeout: 245 seconds]
MajorLag is now known as tgschultz
MajorLag has joined #zig
tgschultz has quit [Ping timeout: 248 seconds]
MajorLag is now known as tgschultz
halosghost has quit [Quit: WeeChat 2.4]
companion_cube has joined #zig
porky11 has quit [Quit: Leaving]
Ichorio has quit [Ping timeout: 248 seconds]
<wilsonk> mq32: did you figure out how to get LTO working with C++ and a zig object?
<wilsonk> if not, then you can do it by outputting all the code as LLVM bitcode and then use LTO across the entire link (at least that is the way I have done it in the past with a different LLVM-based language and clang++ bitcode)
<emekankurumeh[m]> hmm, i thought zig already did lto
hio has quit [Quit: Connection closed for inactivity]
<mrkishi> andrewrk: cloudflare isn't caching from cloudfront "cf-cache-status: MISS" "cache-control: max-age=0, must-revalidate"
<mrkishi> andrewrk: cloudfront isn't caching from s3 "x-cache: Miss from cloudfront"
<mrkishi> :(
fsateler has joined #zig
<mrkishi> can't find how you're uploading the tars though