layneson4 has quit [Remote host closed the connection]
<pixelherodev>
Oh yeah - zero-sized structures == bad at the moment
<pixelherodev>
Given that LLVM has a JIT thing, is it possible - or more importantly practical - to make a simple Zig JIT?
<pixelherodev>
I can imagine a number of challenges (referring to previous compiled objects for a start), and I'm not sure the LLVM JIT would let you add code at runtime
<andrewrk>
pixelherodev, I don't think that's entirely true - sure there may be a few bugs but we also have pretty good test coverage for a lot of zero size types
<pixelherodev>
I meant that I've run into a number of crashes because of them
<andrewrk>
sure
<pixelherodev>
I also probably remember times they've been a nuisance more than the times they've worked :P
<andrewrk>
this is one of the benefits of releases, a point in time when you can give things another chance that you had trouble doing before :)
<pixelherodev>
I figure I can leave the code in the current state for now since it's only being used by me anyways, but once 0.6 drops I'm definitely going to want to migrate everything over and take another look
<ky0ko>
so, in 0.5, i had the line "client.addCSourceFile(source, [_][]const u8 {"-std=c99", "-g"});" in my build.zig. current gives me an error with this about needing an address-of operator to coerce to slice type '[]const []const u8'
<ky0ko>
i can't quite parse this. what is it trying to tell me to do?
layneson has quit [Remote host closed the connection]
layneson has joined #zig
ur5us has joined #zig
<pixelherodev>
Try `&` before the two strings?
<pixelherodev>
Wait
<pixelherodev>
That's a failure to convert to []const [] const u8
<pixelherodev>
Not []const u8
<pixelherodev>
Add an `&` before the `{`?
darithorn has quit [Remote host closed the connection]
<ky0ko>
if i do that it seems to try to interpret the {...} as a scope block instead
<ky0ko>
i.e. it wants me to put semicolons there and tries to interpret the strings as code, giving me errors about ignored values
<fengb>
/plain Need to put &[_]
<fengb>
One day I will master this chat client and not look like a fool
<Cadey>
fengb: but this sentence makes you breathe manually
protty has quit [Remote host closed the connection]
adamkowa1ski has joined #zig
lunamn has quit [Remote host closed the connection]
<adamkowa1ski>
I have a arraylist that i'm appending nodes to. However, it seems like their values get corrupted. I put a debug.warn statement to print the value out before I append it to the array list. The value seems correct
<adamkowa1ski>
However the act of uncommenting the append changes the value and the print now shows that the value is corrupt?
<adamkowa1ski>
Any ideas
<adamkowa1ski>
The test case is on line 173, and the commented line is at 167
nephele_ has joined #zig
nephele has quit [Ping timeout: 250 seconds]
adamkowa1ski has quit [Ping timeout: 268 seconds]
mikdusan has quit [Quit: WeeChat 2.5]
daurnimator has quit [Quit: WeeChat 2.6]
adamkowalski has joined #zig
adamkowalski has quit [Ping timeout: 248 seconds]
daurnimator has joined #zig
benjif has quit [Quit: Leaving]
shritesh has quit [Quit: shritesh]
layneson has quit [Quit: Leaving]
mahmudov has quit [Remote host closed the connection]
muffindrake has quit [Ping timeout: 276 seconds]
muffindrake has joined #zig
commander has quit [Remote host closed the connection]
mikdusan has joined #zig
<mikdusan>
andrewrk: (just follow up). yes b242c2a did solve the problem. Thanks for closing.
adamkowalski has joined #zig
adamkowalski has quit [Client Quit]
darithorn has joined #zig
adamkowalski has joined #zig
<pixelherodev>
fengb, what's the reasoning there?
<fengb>
addCSourceFile takes a slice of slices. It's also in the doc: `exe.addCSourceFile("test.c", &[_][]const u8{"-std=c99"});`
nephele_ is now known as nephele
_Vi has joined #zig
adamkowalski has quit [Quit: Lost terminal]
<pixelherodev>
Oh right, `[_]` is implicitly sized *array*
<pixelherodev>
Not slice
<pixelherodev>
So while a pointer-to-array can decay into a slice, an array cannot
ur5us has quit [Ping timeout: 265 seconds]
leeward has joined #zig
<leeward>
I'm having trouble exposing a C API that wraps an array_list. https://godbolt.org/z/agqEzr Getting an error that says 'std' has no member array_list.
<leeward>
Change export on line 18 to pub, and it builds fine.
leeward has quit [Quit: *Poof*]
<fengb>
It probably doesn’t export array_list. Try std.ArrayList
<fengb>
It builds “fine” without the export because it lazily ignores the function
<dch>
"TODO: support C ABI for more targets" shall I add this to the referred issue, or does this fall under tier-2 still for freebsd?
return0__ has joined #zig
return0e has quit [Ping timeout: 245 seconds]
frmdstryr has joined #zig
protty has joined #zig
leeward has joined #zig
FireFox317 has quit [Ping timeout: 245 seconds]
adamkowalski has joined #zig
<leeward>
fengb: It lazily ignores pub functions when building libraries? That seems odd.
<fengb>
It lazily ignores everything that's not referenced. Pub jsut means exposed, not compiled
<fengb>
Only things that are explicitly used or exported to the linker are actually compiled
<leeward>
So if I wanted to write a library in Zig and only ship the object code, I'd have to use the C ABI?
<fengb>
Yes, until we define a Zig ABI
<leeward>
Well that's a surprise but I guess it's not unreasonable.
waleee-cl has joined #zig
<leeward>
Thanks though. It looks like you were right about array_list.
<mq32>
fengb, leeward: i don't think it's possible to define an ABI for Zig
<mq32>
except for ZigIR maybe
<mq32>
because functions with comptime parameters cannot be compiled to machine code
marmotini_ has joined #zig
frmdstryr has quit [Remote host closed the connection]
marmotini_ has quit [Remote host closed the connection]
<leeward>
mq32: that's an interesting point. A library distributed as ZigIR would be pretty cool though, since it'd be able to target more than 1 platform.
<riba>
what is the correct way to pass a zig-string (which i got by allocPrint and manually terminated with a "\x00") to c? i tried the .ptr field of the resulting slice but that does not seem to be the right thing to do
<riba>
at least when i pass the slice.ptr to the c format string as %s, it prints the address
<riba>
no, that is wrong
<riba>
it's allocPrint which prints the address
<riba>
i have a cstring, so i give allocPrint the cstring.?
<riba>
i'll have to think about that
<riba>
same happens if i just give it the pointer though
<riba>
so i guess the question is, how do i pass a c string to allocPrint
tdeo has joined #zig
<fengb>
CString is removed from master
<riba>
i guess i mean [*c]const u8
protty has quit [Ping timeout: 260 seconds]
<riba>
oh well, the daily 15 minutes of coding are over
riba has quit [Read error: Connection reset by peer]
dimenus has quit [Killed (sinisalo.freenode.net (Nickname regained by services))]
dimenus has joined #zig
Guest99598 has joined #zig
ofelas has quit [Quit: shutdown -h now]
<D3zmodos>
Is there a simple way in zig to recursively print a struct? (purely for debugging purposes, similarly to how golang's %+v does) JSON serialization would do but I don't see any functions in the stdlib json code for serializing structs (unless I'm missing something? >.>)
ur5us has joined #zig
<D3zmodos>
oh wait...the default formatting does this already for struct members that are other structs...but seemingly not if they are arrays? (I just get `typename@address`)
lunamn has joined #zig
darithorn has quit [Quit: Leaving]
<andrewrk>
D3zmodos, that can be improved
THFKA4 has joined #zig
jjido has quit [Quit: Connection closed for inactivity]
data-man has joined #zig
<data-man>
andrewrk: I planned to do it after my vector's formatting PR
waleee-cl has quit [Quit: Connection closed for inactivity]
SimonNa has joined #zig
daurnimator has quit [Ping timeout: 246 seconds]
tines9 has quit [Ping timeout: 250 seconds]
layneson has joined #zig
daurnimator has joined #zig
data-man has quit [Quit: Konversation terminated!]
dimenus has quit [Ping timeout: 252 seconds]
daurnimator has quit [Ping timeout: 248 seconds]
tines9 has joined #zig
daurnimator has joined #zig
GrooveStomp has joined #zig
ltriant has joined #zig
wootehfoot has quit [Read error: Connection reset by peer]
darithorn has joined #zig
adamkowalski has joined #zig
ur5us_ has joined #zig
ur5us has quit [Read error: Connection reset by peer]