#Where are functions like @panic located?
1 messages · Page 1 of 1 (latest)
@panic specifically calls std.builtin.default_panic or an exposed panic handler in root
Others are kinda scattered. You can find some in src/Sema.zig
how about if. Icontribute a function like this:
pub fn swap(x: T, y: T) [2]T {
return [2]T{x, y};
}
or
pub fn swap(x: T, y: T) void {
const tmp = a.*;
a.* = b.*;
b.* = tmp;
}
I doubt it would be accepted, since std.mem.swap exists
do you think an @swap() function makes sence?
if you are referring to functions starting with @, those are builtins. they are handled by the zig compiler. the implementation doesn't look like a normal zig function that you call, but rather a transformation done by the compiler to convert the builtin into a lower form.
afaik builtin functions are only for things that are impractical/impossible to implement in userspace
(so probably not)
or sometimes for things that can be much better optimized as a builtin than as userspace
ye
Thanks a lot everyone
It's good that you were willing to be the change you wanted to see, though