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/
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #zig
laaron has quit [Ping timeout: 260 seconds]
laaron has joined #zig
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 245 seconds]
earnestly has quit [Ping timeout: 276 seconds]
earnestly has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
Tetralux has quit [Ping timeout: 276 seconds]
_whitelogger has joined #zig
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 246 seconds]
mahmudov has quit [Remote host closed the connection]
laaron has quit [Remote host closed the connection]
return0e has quit [Remote host closed the connection]
return0e has joined #zig
laaron has joined #zig
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 265 seconds]
chemist69 has quit [Ping timeout: 246 seconds]
chemist69 has joined #zig
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 245 seconds]
marler8997_1 has quit [Ping timeout: 246 seconds]
<stratact> Sigh, I would love to see Zig supported in codewars.com
<bgiannan> n
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #zig
kristoff_it has joined #zig
marmotini_ has joined #zig
kristoff_it has quit [Ping timeout: 265 seconds]
kristoff_it has joined #zig
laaron has quit [Remote host closed the connection]
laaron has joined #zig
kristoff_it has quit [Ping timeout: 240 seconds]
avoidr has quit [Quit: leaving]
qazo_ has joined #zig
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 245 seconds]
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 276 seconds]
donpdonp has quit [Read error: Connection reset by peer]
samtebbs has joined #zig
donpdonp has joined #zig
Ichorio has joined #zig
laaron has quit [Remote host closed the connection]
laaron has joined #zig
marmotini_ has quit [Quit: Leaving]
laaron has quit [Remote host closed the connection]
laaron has joined #zig
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 246 seconds]
fgenesis has joined #zig
waleee-cl has joined #zig
Ichorio has quit [Ping timeout: 245 seconds]
Hirezias has joined #zig
avoidr has joined #zig
<Hirezias> Hello, does something equivalent to __attribute__((constructore))/((destructor) exist in zig ?
<fengb> No constructors/destructors
<Hirezias> I'm not talking about OO programming, I'm talking about dynamic library loading/unloading, right ?
<fengb> Oh. I don't think zig will support that since it falls under hidden behavior
halosghost has joined #zig
<Hirezias> Ok, it makes sense. Thank you :)
dimenus_ has joined #zig
<samtebbs> Hirezias: Just for my interest, what do they do?
<Hirezias> I'm not really sure about how it works exactly, but this attributes are a way to specify a function must be called at dynamic library load or unload
<Hirezias> A use case I have is to build a library A with the same symbols than another one (B) used by a program. I use LD_PRELOAD in order to load A before B at program startup, wich link my functions instead of the B one's.
dimenus_ has quit [Read error: Connection reset by peer]
<Hirezias> I use __attribute__((constructor)) in order to run a function between library loading and the program execution in wich I get the B symbols with delsym in order to call it in my wrapper functions, even if thez have the same symbols names.
TheLemonMan has joined #zig
<Hirezias> *dlsym (sorry, I hope my explanation is clear)
<TheLemonMan> Hirezias, here you go kind sir https://gist.github.com/031c98e75384c1fc28a2905826a51d1b
<mikdusan> zig has a built-in clang compiler. i suppose you could make a c-func to invoke zig code
<TheLemonMan> please keep in mind that you have to link against the libc in order to have the crt process the init/fini
<mikdusan> TheLemonMan: which os supports those link sections?
<TheLemonMan> the only ones that matter, linux (and I guess the BSDs)
<TheLemonMan> for osx you may be able to use __mod_init_func/__mod_term_func for the same purpose
<fgenesis> windows does too but it's some magic the CRT invokes at DLlMain(), iirc
<fgenesis> *DllMain()
<TheLemonMan> yeah, it has more to do with the libc's CRT than with the OS itself
<mikdusan> also .dylib on macos has old convention of _init() and _fini() . which sounds like windows mechanism. linux also has linker-line to add functions via -init and -fini flags
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #zig
Tetralux has joined #zig
<Hirezias> When I include dlfcn.h and write const RTLD_NEXT = c.RTLD_NEXT; I have an error saying that a C pointers cannot point to non-C-ABI-compatible type 'void' (in cimport.zig)
<Tetralux> mikdusan: Why would you want to make defer free illegal in a particular instance?
<meowray> mikdusan: elf linkers don't have options to add .init_aray or .fini_array
<TheLemonMan> meowray, the -init/-fini switches in LLD should append/remove entries in the init/fini arrays
<mikdusan> Tetralux: why would i want the option to defer a no-op ?
Ichorio has joined #zig
<Tetralux> mikdusan: In case it isn't xD
<Tetralux> I'm assuming it's library code.
<Tetralux> Because otherwise, if you knew it was always a no-op, you wouldn't write that code.
<Tetralux> (.. you'd omit the defer.)
<mikdusan> statically in my case it is always a no-op because i'll always be using an allocator that only free's in bulk
<Tetralux> In such a case, is the free a no-op in the output?
<Tetralux> Or does it still do a fnptr call that does nothing?
<mikdusan> let's assume the best-case scenerio that the compiler elide's it entirely.
<Tetralux> Indeed.
<Tetralux> I'm not entirely clear what the reasoning is here.
<Tetralux> You want to be able to get an error if you attempt to free something that does a no-op?
<mikdusan> i want to prevent someone from sticking an unsuitable allocator into the struct
<Tetralux> You want to only allow a push-buffer style allocator?
<Tetralux> .. or rather, one that frees everything at once, or nothing.
<Tetralux> .. but without using a custom allocator interface.
dimenus_ has joined #zig
samtebbs has quit [Quit: leaving]
wootehfoot has joined #zig
<mikdusan> i have a struct init that accepts an *Allocator and the "doc" would stipulate that it must be arena-style because I won't be adding defer's all over the place for nothing. and so if the wrong allocator is passed in, it's an automatic leak
Ichorio has quit [Ping timeout: 245 seconds]
<mikdusan> i mean yeah the caller is doing it wrong. but shouldn't there be a way for me to statically prevent this?
<Tetralux> The obvious way to statically do it would be as you suggested: have an allocator type that does not free.
<Tetralux> Docs wise, you could just simply include "Does not free".
<Tetralux> And then if you pass a direct_allocator or something, you expect it to leak
<Tetralux> Which may be absolutely fine.
<fengb> So if shrinkFn is optional, you can add an assert
<Tetralux> Making shrinkFn optional definitely means that it would not get optimized.
<Tetralux> I'd just make it either do literally nothing, or panic.
<fengb> None of this is optimized since they're all function pointers
<Tetralux> Then it's probably better just to make it do nothing.
<Tetralux> You don't want users of allocators to have to check that.
<Tetralux> The whole point is that they don't.
<Tetralux> The whole point generally is that they will use whatever allocator you give them.
<Tetralux> So far, they assume that they must call free.
<Tetralux> This pattern of never freeing though is perhaps what temporary storage could be used for.
<Tetralux> But I don't that zigian.
<Tetralux> It's basically just push buffer that the user resets on demand where the whole point is that you allocate it all up front and then when you want to make a cstring version of a string, or format a string to be output every frame, you want it to be fast and not allocate, but still be able to be used with otherwise allocating functions.
<Tetralux> In Zig, you're expected to make an fixedbufferallocator, though you can't reset that.
<Tetralux> Might make a PR for that at some point actually.
<Tetralux> fba.reset(); // forgets you ever alloc'd anything
<Tetralux> But yes, I think I'd just doc it and allow any allocator.
Akuli has joined #zig
lunamn_ has joined #zig
lunamn has quit [Ping timeout: 245 seconds]
<Hirezias> TheLemonMan: Thank you very much for your help :)
laaron has quit [Remote host closed the connection]
ky1ko is now known as ky0ko
laaron has joined #zig
<TheLemonMan> np, it's a nice party trick :)
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 276 seconds]
<Tetralux> We should have a better error message if you attempt to 'try' from within a fn that does not return an error.
<fengb> Like injecting a yodaism?
wootehfoot has quit [Read error: Connection reset by peer]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #zig
<Tetralux> fengb: ?
<Tetralux> Og
<Tetralux> Oh&
<Tetralux> Oh***
<Tetralux> You mean "This isn't the return type you were looking for..." ;D
<Tetralux> I was thinking of something like, "expected return type of []u8, got ![]u8`
<Tetralux> Or even just, "<function name> does not return an error"
<Tetralux> "note: function signature here"
<Tetralux> "fn blah() []u8 {"
<Tetralux> " ^"
<TheLemonMan> Tetralux, I always mistake your GH avatar for Sonic the Hedgehog
<Tetralux> GH?
<halosghost> github, presumably
<Tetralux> Ah yeah
<Tetralux> XD
<fengb> Do or do not. There is no try
<fengb> Yoda is a lousy teacher
<Tetralux> LemonMan: I'm not entirely sure how you can mistake Sonic for an eyeball, but... ;)
<Tetralux> fengb: That took me longer than I'd like to admit to realise what the fuck you were talking about.
<Tetralux> I am ashamed of myself.
<Tetralux> Also well played :p
<fengb> It was a bad joke so I didn't want to say it outright
Hirezias has quit [Ping timeout: 246 seconds]
<Tetralux> HAHAH
<TheLemonMan> Tetralux, well, it's blue and small
<Tetralux> TheLemonMan: This is a true fact is that.
<Tetralux> Also question:
<Tetralux> Why is the alignment for alignedAlloc comptime?
<TheLemonMan> check out the return type
<Tetralux> Only I'm making an allocator which calls a child allocator.
<Tetralux> But I want to pass new_align through to it and can't.
<Tetralux> new_align is non-comptime and that's the mem.Allocator signature so I can't change it.
<fengb> Recent change
<fengb> Er wait
<fengb> Ignore me
* Tetralux grins
<fengb> TheLemonMan is right, it's needed for the return signature
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 276 seconds]
<TheLemonMan> a better error for `unreachable`: https://xkcd.com/2200/
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 245 seconds]
<halosghost> lol
Ichorio has joined #zig
porky11 has joined #zig
Ichorio has quit [Ping timeout: 245 seconds]
Ichorio has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
<dimenus_> wow, that uefi pr is nice work
<dimenus_> should make working with uefi in zig pretty easy
dimenus_ is now known as rsdimenus
FireFox317 has joined #zig
<FireFox317> This guy (is he in here?) is making some pretty nice code: https://github.com/kprotty/zap. Maybe that is also helpful for our std
wilsonk__ has joined #zig
jzck has quit [Remote host closed the connection]
Demos[m] has quit [Read error: Connection reset by peer]
fengb has quit [Remote host closed the connection]
BitPuffin has quit [Read error: Connection reset by peer]
D3zmodos has quit [Remote host closed the connection]
vegai has quit [Read error: Connection reset by peer]
Snektron has quit [Remote host closed the connection]
BitPuffin has joined #zig
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
Akuli has quit [Quit: Leaving]
Demos[m] has joined #zig
D3zmodos has joined #zig
jzck has joined #zig
vegai has joined #zig
fengb has joined #zig
FireFox317 has quit [Ping timeout: 265 seconds]
halosghost has quit [Quit: WeeChat 2.6]
kristoff_it has joined #zig
porky11 has quit [Quit: Leaving]
mahmudov has joined #zig
Snektron has joined #zig
drazan has quit [Ping timeout: 244 seconds]
drazan has joined #zig
<dimenus> has anyone considered picking up a riscv board?
<dimenus> if so, who did you get it from?