OpenBSD work in progress ports
list obsolete files between OpenBSD upgrades
Script helper for building rustc and cargo from source on OpenBSD (without rustup)
a way to know when a running program is using an old version of upgraded files (for OpenBSD)
a safe, concurrent, practical language (latest working version for openbsd - but some PR maybe pending)
development repository for lang/rust openbsd port tree
development repository for productivity/tryton openbsd ports tree
semarie/cargo-generate-vendor 0
Tool for generating metadata for cargo vendoring
OpenBSD httpd
OpenBSD: dump struct buf via kvm(3)
Pull request review commentziglang/zig
fn testSentinel() void { testing.expect(sentinel(*const [5]u8) == null); } ++/// Return the child type of the given type. This differs from `Child` in that it handles "One Pointer"+/// and Optional types by returning the grandchild type instead of the direct child type.+pub fn ArrayChild(comptime T: type) type {+ return switch (@typeInfo(T)) {+ .Array => |info| info.child,+ .Vector => |info| info.child,+ .Pointer => |info| if (info.size == .One) Child(info.child) else info.child,+ .Optional => |info| ArrayChild(info.child),+ else => @compileError("Expected pointer, array or vector type, found '" ++ @typeName(T) ++ "'"),+ };+}++test "std.meta.ArrayChild" {+ testing.expect(ArrayChild([1]u8) == u8);+ testing.expect(ArrayChild(*[1]u8) == u8);+ testing.expect(ArrayChild([*]u8) == u8);+ testing.expect(ArrayChild(*[*]u8) == u8);+ testing.expect(ArrayChild([]u8) == u8);+ testing.expect(ArrayChild(*[]u8) == u8);++ testing.expect(ArrayChild(?[1]u8) == u8);+ testing.expect(ArrayChild(?*[1]u8) == u8);+ testing.expect(ArrayChild(?[*]u8) == u8);+ testing.expect(ArrayChild(?*[*]u8) == u8);+ testing.expect(ArrayChild(?[]u8) == u8);+ testing.expect(ArrayChild(?*[]u8) == u8);++ testing.expect(ArrayChild(Vector(2, u8)) == u8);+ testing.expect(ArrayChild(*Vector(2, u8)) == u8);+ testing.expect(ArrayChild(?Vector(2, u8)) == u8);+}++/// Returns the given Slice or "Many Pointer" type with the same type except with the given sentinel value.+pub fn Sentinel(comptime T: type, comptime sentinel_val: ArrayChild(T)) type {+ return SentinelImpl(T, sentinel_val, false);+}++pub fn SentinelImpl(comptime T: type, comptime sentinel_val: ArrayChild(T), comptime in_child: bool) type {+ const err = "unable to derive a sentinel pointer type from " ++ @typeName(T);+ switch (@typeInfo(T)) {+ .Array => |info| {+ return @Type(builtin.TypeInfo { .Array = .{+ .len = info.len,+ .child = info.child,+ .sentinel = sentinel_val,+ }});+ },+ .Pointer => |info| {+ switch (info.size) {+ .One => {+ if (in_child) @compileError(err);+ return @Type(builtin.TypeInfo { .Pointer = .{+ .size = info.size,+ .is_const = info.is_const,+ .is_volatile = info.is_volatile,+ .alignment = info.alignment,+ .child = SentinelImpl(info.child, sentinel_val, true),+ .is_allowzero = info.is_allowzero,+ .sentinel = info.sentinel,+ }});+ },+ .C => @compileError("??? handle C pointers ???"),+ .Many, .Slice => {+ return @Type(builtin.TypeInfo { .Pointer = .{+ .size = info.size,+ .is_const = info.is_const,+ .is_volatile = info.is_volatile,+ .alignment = info.alignment,+ .child = info.child,+ .is_allowzero = info.is_allowzero,+ .sentinel = sentinel_val,+ }});+ },+ }+ },+ else => @compileError(err),+ }+}++/// Takes a Slice or Many Pointer and returns it with the Type modified to have the given sentinel value.+/// This function assumes the caller has verified the memory contains the sentinel value.+pub fn assumeSentinel(p: anytype, comptime sentinel_val: ArrayChild(@TypeOf(p))) Sentinel(@TypeOf(p), sentinel_val) {+ const T = @TypeOf(p);+ const err = "unable to derive a sentinel pointer type from " ++ @typeName(T);+ const ReturnType = Sentinel(T, sentinel_val);+ switch (@typeInfo(T)) {+ .Pointer => |info| {+ switch (info.size) {+ .Slice => return @bitCast(ReturnType, p),
I'm not sure how that's relevant here. This is casting one slice type to another, the only difference being that the new type has a sentinel value. This can't affect the in-memory representation as far as I know.
comment created time in 14 minutes
Pull request review commentziglang/zig
fn testSentinel() void { testing.expect(sentinel(*const [5]u8) == null); } ++/// Return the child type of the given type. This differs from `Child` in that it handles "One Pointer"+/// and Optional types by returning the grandchild type instead of the direct child type.+pub fn ArrayChild(comptime T: type) type {
Yes it will error on *?u8, because it will call Child on u8 and you'll get an error. Supporting optional types is actually quite common because nullable pointers are represented as optionals. Take a look at the test cases.
comment created time in 15 minutes
issue commentziglang/zig
Technically a duplicate of #5805 , which was marked as "closed".
Bit operators were however considered for vectors of bool, and for uniformity potentially all bool, but then I don't think that proposal was ever opened.
!=is the same as boolean xor but the intent is a bit less readable
For the intent in the OP, "check if two conditions are different", to me != looks more readable than ^.
What looks unusual to me however is composing multiple: a != b != c != d vs a ^ b ^ c ^ d
For keywords, note that currently Zig keywords influence control flow (short-circuit and and or, the only exception to this are function calls), while operators don't (regular & and |).
As xor cannot be short-circuit-evaluated, a keyword would go against the convention up to now.
comment created time in 5 hours
push eventziglang/zig
commit sha daf6c0da5b2d96530dea2d2a907f2b2ba55c8ba6
CONTRIBUTING: src-self-hosted -> src
push time in 6 hours
PR merged ziglang/zig
For the first line in the diff, my editor removed the line ending (no actual content), so feel free to ignore that line.
pr closed time in 6 hours
PR opened ziglang/zig
For the first line in the diff, my editor removed the line ending (no actual content), so feel free to ignore that line.
pr created time in 7 hours
issue openedziglang/zig
intermediate "expanding" allocator for intermediate allocator composing strategies
In exploring composing the GPA with the CAllocator (and other allocators, such as the beam allocator: http://erlang.org/doc/man/erl_nif.html#enif_alloc) it occurred to me it might be useful to have "intermediate" allocator strategies available, for when higher-order alignment (page alignment, e.g.) were desirable for things besides just malloc. I abstracted the relevant material from the CAllocator and built this: Would it be useful to contrib this back into the stdlib?
https://github.com/ityonemo/zigler/blob/0.7.0/priv/beam/expand_allocator.zig
created time in 8 hours
PR opened ziglang/zig
this change allows overriding the gpa mutex type; without altering the current "threadsafe" api for configuration.
| threadsafe | mutex | result | |============|==========|=================| | true | nil | std.Mutex | | false | nil | std.mutex.Dummy | | <any> | mystruct | mystruct |
pr created time in 8 hours
PR opened ziglang/zig
Prevent the crash by not making the codegen try to access the non-existing ptr field in the slice.
Closes #6951
pr created time in 8 hours
issue commentziglang/zig
Generic typechecked interfaces
It would be a bit nicer if it's always invoked @compileError with a human friendly error instead of a bool flag since after a few constraints it becomes difficult to generate meaningful error automatically. #6615 is related and could provide the same thing by @compileError in the function called on the type.
comment created time in 9 hours
Pull request review commentziglang/zig
fn testSentinel() void { testing.expect(sentinel(*const [5]u8) == null); } ++/// Return the child type of the given type. This differs from `Child` in that it handles "One Pointer"+/// and Optional types by returning the grandchild type instead of the direct child type.+pub fn ArrayChild(comptime T: type) type {
This is very similar to what Elem does. Your version won't @compileError on *?u8.
I am not convinced accepting optional types is always desirable.
BTW, Elem could use some examples in its doc comment.
comment created time in 10 hours
Pull request review commentziglang/zig
fn testSentinel() void { testing.expect(sentinel(*const [5]u8) == null); } ++/// Return the child type of the given type. This differs from `Child` in that it handles "One Pointer"+/// and Optional types by returning the grandchild type instead of the direct child type.+pub fn ArrayChild(comptime T: type) type {+ return switch (@typeInfo(T)) {+ .Array => |info| info.child,+ .Vector => |info| info.child,+ .Pointer => |info| if (info.size == .One) Child(info.child) else info.child,+ .Optional => |info| ArrayChild(info.child),+ else => @compileError("Expected pointer, array or vector type, found '" ++ @typeName(T) ++ "'"),+ };+}++test "std.meta.ArrayChild" {+ testing.expect(ArrayChild([1]u8) == u8);+ testing.expect(ArrayChild(*[1]u8) == u8);+ testing.expect(ArrayChild([*]u8) == u8);+ testing.expect(ArrayChild(*[*]u8) == u8);+ testing.expect(ArrayChild([]u8) == u8);+ testing.expect(ArrayChild(*[]u8) == u8);++ testing.expect(ArrayChild(?[1]u8) == u8);+ testing.expect(ArrayChild(?*[1]u8) == u8);+ testing.expect(ArrayChild(?[*]u8) == u8);+ testing.expect(ArrayChild(?*[*]u8) == u8);+ testing.expect(ArrayChild(?[]u8) == u8);+ testing.expect(ArrayChild(?*[]u8) == u8);++ testing.expect(ArrayChild(Vector(2, u8)) == u8);+ testing.expect(ArrayChild(*Vector(2, u8)) == u8);+ testing.expect(ArrayChild(?Vector(2, u8)) == u8);+}++/// Returns the given Slice or "Many Pointer" type with the same type except with the given sentinel value.+pub fn Sentinel(comptime T: type, comptime sentinel_val: ArrayChild(T)) type {+ return SentinelImpl(T, sentinel_val, false);+}++pub fn SentinelImpl(comptime T: type, comptime sentinel_val: ArrayChild(T), comptime in_child: bool) type {+ const err = "unable to derive a sentinel pointer type from " ++ @typeName(T);+ switch (@typeInfo(T)) {+ .Array => |info| {+ return @Type(builtin.TypeInfo { .Array = .{+ .len = info.len,+ .child = info.child,+ .sentinel = sentinel_val,+ }});+ },+ .Pointer => |info| {+ switch (info.size) {+ .One => {+ if (in_child) @compileError(err);+ return @Type(builtin.TypeInfo { .Pointer = .{+ .size = info.size,+ .is_const = info.is_const,+ .is_volatile = info.is_volatile,+ .alignment = info.alignment,+ .child = SentinelImpl(info.child, sentinel_val, true),+ .is_allowzero = info.is_allowzero,+ .sentinel = info.sentinel,+ }});+ },+ .C => @compileError("??? handle C pointers ???"),+ .Many, .Slice => {+ return @Type(builtin.TypeInfo { .Pointer = .{+ .size = info.size,+ .is_const = info.is_const,+ .is_volatile = info.is_volatile,+ .alignment = info.alignment,+ .child = info.child,+ .is_allowzero = info.is_allowzero,+ .sentinel = sentinel_val,+ }});+ },+ }+ },+ else => @compileError(err),+ }+}++/// Takes a Slice or Many Pointer and returns it with the Type modified to have the given sentinel value.+/// This function assumes the caller has verified the memory contains the sentinel value.+pub fn assumeSentinel(p: anytype, comptime sentinel_val: ArrayChild(@TypeOf(p))) Sentinel(@TypeOf(p), sentinel_val) {+ const T = @TypeOf(p);+ const err = "unable to derive a sentinel pointer type from " ++ @typeName(T);+ const ReturnType = Sentinel(T, sentinel_val);+ switch (@typeInfo(T)) {+ .Pointer => |info| {+ switch (info.size) {+ .Slice => return @bitCast(ReturnType, p),
Slices do not have a defined in-memory representation.
comment created time in 9 hours
Pull request review commentziglang/zig
pub const File = struct { pub fn makeExecutable(base: *File) !void { switch (base.tag) {- .coff, .elf, .macho => if (base.file) |f| {+ .macho => if (base.file) |f| {+ if (base.intermediary_basename != null) {+ // The file we have open is not the final file that we want to+ // make executable, so we don't have to close it.+ return;+ }+ if (comptime std.Target.current.isDarwin() and std.Target.current.cpu.arch == .aarch64) {+ if (base.options.target.cpu.arch != .aarch64) return; // If we're not targeting aarch64, nothing to do.+ // XNU starting with Big Sur running on arm64 is caching inodes of running binaries.+ // Any change to the binary will effectively invalidate the kernel's cache+ // resulting in a SIGKILL on each subsequent run. Since when doing incremental+ // linking we're modifying a binary in-place, this will end up with the kernel+ // killing it on every subsequent run. To circumvent it, we will copy the file+ // into a new inode, remove the original file, and rename the copy to match+ // the original file. This is super messy, but there doesn't seem any other+ // way to please the XNU.+ const random_bytes_len = 12;+ comptime const random_sub_path_len = std.base64.Base64Encoder.calcSize(random_bytes_len);+ const emit = base.options.emit orelse return;+ var random_bytes: [random_bytes_len]u8 = undefined;+ try std.crypto.randomBytes(&random_bytes);+ var random_sub_path: [random_sub_path_len]u8 = undefined;+ fs.base64_encoder.encode(&random_sub_path, &random_bytes);+ const tmp_file_name = try mem.join(base.allocator, "_", &[_][]const u8{ emit.sub_path, random_sub_path[0..] });+ defer base.allocator.free(tmp_file_name);+ var tmp_file = try emit.directory.handle.createFile(tmp_file_name, .{ .mode = determineMode(base.options) });+ defer tmp_file.close();+ const stat = try f.stat();+ _ = try f.copyRangeAll(0, tmp_file, 0, stat.size);
You're a genius @LemonBoy! Works like a charm, thanks so much for this absolutely brilliant suggestion!
comment created time in 10 hours
pull request commentziglang/zig
stage1: Force union member types to be resolved
cherry picked into 0.7.x => 36b8f5d194c1c88e25eee3da111000edbe9eb3ea
comment created time in 10 hours
issue commentziglang/zig
Generic typechecked interfaces
Related: #1669
comment created time in 11 hours
issue openedziglang/zig
Generic typechecked interfaces
So one thing we do a lot is pass in a type to specialize on. And thanks to std.meta.traits we can write functions that are arbitrarily complex and get a bool back that tells us if it fulfills some requirements. However right now you have to put checking for traits in the function and not as part of the signature. While this isn't the biggest deal I think it would be a good idea to be able to put in a set of boolean expressions evaluated at comptime and if any of them evaluates to false it will result in a compile error that tells you which expressions evaluated to false. This should let us put the compile error at the call site rather than in the function and it removes some code duplication.
created time in 11 hours
Pull request review commentziglang/zig
pub const File = struct { pub fn makeExecutable(base: *File) !void { switch (base.tag) {- .coff, .elf, .macho => if (base.file) |f| {+ .macho => if (base.file) |f| {+ if (base.intermediary_basename != null) {+ // The file we have open is not the final file that we want to+ // make executable, so we don't have to close it.+ return;+ }+ if (comptime std.Target.current.isDarwin() and std.Target.current.cpu.arch == .aarch64) {+ if (base.options.target.cpu.arch != .aarch64) return; // If we're not targeting aarch64, nothing to do.+ // XNU starting with Big Sur running on arm64 is caching inodes of running binaries.+ // Any change to the binary will effectively invalidate the kernel's cache+ // resulting in a SIGKILL on each subsequent run. Since when doing incremental+ // linking we're modifying a binary in-place, this will end up with the kernel+ // killing it on every subsequent run. To circumvent it, we will copy the file+ // into a new inode, remove the original file, and rename the copy to match+ // the original file. This is super messy, but there doesn't seem any other+ // way to please the XNU.+ const random_bytes_len = 12;+ comptime const random_sub_path_len = std.base64.Base64Encoder.calcSize(random_bytes_len);+ const emit = base.options.emit orelse return;+ var random_bytes: [random_bytes_len]u8 = undefined;+ try std.crypto.randomBytes(&random_bytes);+ var random_sub_path: [random_sub_path_len]u8 = undefined;+ fs.base64_encoder.encode(&random_sub_path, &random_bytes);+ const tmp_file_name = try mem.join(base.allocator, "_", &[_][]const u8{ emit.sub_path, random_sub_path[0..] });+ defer base.allocator.free(tmp_file_name);+ var tmp_file = try emit.directory.handle.createFile(tmp_file_name, .{ .mode = determineMode(base.options) });+ defer tmp_file.close();+ const stat = try f.stat();+ _ = try f.copyRangeAll(0, tmp_file, 0, stat.size);
I wonder if copyFile with the same source and destination name would do the trick. Under the hood it creates a new file with a random name and then calls `renameat, it could possibly work.
comment created time in 11 hours
Pull request review commentziglang/zig
pub const File = struct { pub fn makeExecutable(base: *File) !void { switch (base.tag) {- .coff, .elf, .macho => if (base.file) |f| {+ .macho => if (base.file) |f| {+ if (base.intermediary_basename != null) {+ // The file we have open is not the final file that we want to+ // make executable, so we don't have to close it.+ return;+ }+ if (comptime std.Target.current.isDarwin() and std.Target.current.cpu.arch == .aarch64) {+ if (base.options.target.cpu.arch != .aarch64) return; // If we're not targeting aarch64, nothing to do.+ // XNU starting with Big Sur running on arm64 is caching inodes of running binaries.+ // Any change to the binary will effectively invalidate the kernel's cache+ // resulting in a SIGKILL on each subsequent run. Since when doing incremental+ // linking we're modifying a binary in-place, this will end up with the kernel+ // killing it on every subsequent run. To circumvent it, we will copy the file+ // into a new inode, remove the original file, and rename the copy to match+ // the original file. This is super messy, but there doesn't seem any other+ // way to please the XNU.+ const random_bytes_len = 12;+ comptime const random_sub_path_len = std.base64.Base64Encoder.calcSize(random_bytes_len);+ const emit = base.options.emit orelse return;+ var random_bytes: [random_bytes_len]u8 = undefined;+ try std.crypto.randomBytes(&random_bytes);+ var random_sub_path: [random_sub_path_len]u8 = undefined;+ fs.base64_encoder.encode(&random_sub_path, &random_bytes);+ const tmp_file_name = try mem.join(base.allocator, "_", &[_][]const u8{ emit.sub_path, random_sub_path[0..] });+ defer base.allocator.free(tmp_file_name);+ var tmp_file = try emit.directory.handle.createFile(tmp_file_name, .{ .mode = determineMode(base.options) });+ defer tmp_file.close();+ const stat = try f.stat();+ _ = try f.copyRangeAll(0, tmp_file, 0, stat.size);
Done in a8f8d82.
comment created time in 11 hours
Pull request review commentziglang/zig
pub const File = struct { pub fn makeExecutable(base: *File) !void { switch (base.tag) {- .coff, .elf, .macho => if (base.file) |f| {+ .macho => if (base.file) |f| {+ if (base.intermediary_basename != null) {+ // The file we have open is not the final file that we want to+ // make executable, so we don't have to close it.+ return;+ }+ if (comptime std.Target.current.isDarwin() and std.Target.current.cpu.arch == .aarch64) {+ if (base.options.target.cpu.arch != .aarch64) return; // If we're not targeting aarch64, nothing to do.+ // XNU starting with Big Sur running on arm64 is caching inodes of running binaries.+ // Any change to the binary will effectively invalidate the kernel's cache+ // resulting in a SIGKILL on each subsequent run. Since when doing incremental+ // linking we're modifying a binary in-place, this will end up with the kernel+ // killing it on every subsequent run. To circumvent it, we will copy the file+ // into a new inode, remove the original file, and rename the copy to match+ // the original file. This is super messy, but there doesn't seem any other+ // way to please the XNU.+ const random_bytes_len = 12;+ comptime const random_sub_path_len = std.base64.Base64Encoder.calcSize(random_bytes_len);+ const emit = base.options.emit orelse return;+ var random_bytes: [random_bytes_len]u8 = undefined;+ try std.crypto.randomBytes(&random_bytes);+ var random_sub_path: [random_sub_path_len]u8 = undefined;+ fs.base64_encoder.encode(&random_sub_path, &random_bytes);+ const tmp_file_name = try mem.join(base.allocator, "_", &[_][]const u8{ emit.sub_path, random_sub_path[0..] });+ defer base.allocator.free(tmp_file_name);+ var tmp_file = try emit.directory.handle.createFile(tmp_file_name, .{ .mode = determineMode(base.options) });+ defer tmp_file.close();+ const stat = try f.stat();+ _ = try f.copyRangeAll(0, tmp_file, 0, stat.size);
Excellent suggestion, thanks!
comment created time in 11 hours
Pull request review commentziglang/zig
pub const File = struct { pub fn makeExecutable(base: *File) !void { switch (base.tag) {- .coff, .elf, .macho => if (base.file) |f| {+ .macho => if (base.file) |f| {+ if (base.intermediary_basename != null) {+ // The file we have open is not the final file that we want to+ // make executable, so we don't have to close it.+ return;+ }+ if (comptime std.Target.current.isDarwin() and std.Target.current.cpu.arch == .aarch64) {+ if (base.options.target.cpu.arch != .aarch64) return; // If we're not targeting aarch64, nothing to do.+ // XNU starting with Big Sur running on arm64 is caching inodes of running binaries.+ // Any change to the binary will effectively invalidate the kernel's cache+ // resulting in a SIGKILL on each subsequent run. Since when doing incremental+ // linking we're modifying a binary in-place, this will end up with the kernel+ // killing it on every subsequent run. To circumvent it, we will copy the file+ // into a new inode, remove the original file, and rename the copy to match+ // the original file. This is super messy, but there doesn't seem any other+ // way to please the XNU.+ const random_bytes_len = 12;+ comptime const random_sub_path_len = std.base64.Base64Encoder.calcSize(random_bytes_len);+ const emit = base.options.emit orelse return;+ var random_bytes: [random_bytes_len]u8 = undefined;+ try std.crypto.randomBytes(&random_bytes);+ var random_sub_path: [random_sub_path_len]u8 = undefined;+ fs.base64_encoder.encode(&random_sub_path, &random_bytes);+ const tmp_file_name = try mem.join(base.allocator, "_", &[_][]const u8{ emit.sub_path, random_sub_path[0..] });+ defer base.allocator.free(tmp_file_name);+ var tmp_file = try emit.directory.handle.createFile(tmp_file_name, .{ .mode = determineMode(base.options) });+ defer tmp_file.close();+ const stat = try f.stat();+ _ = try f.copyRangeAll(0, tmp_file, 0, stat.size);
I think you can clean a lot of code by using Dir.copyFile here.
comment created time in 11 hours
push eventziglang/zig
commit sha 36b8f5d194c1c88e25eee3da111000edbe9eb3ea
stage1: Force union member types to be resolved No test case because I couldn't reduce the huuuge test case. Fixes the problem discovered by @ifreund.
push time in 11 hours
push eventziglang/zig
commit sha 21c488ce68480d5298fc51f80f2c854d4ec8c364
stage1: Force union member types to be resolved No test case because I couldn't reduce the huuuge test case. Fixes the problem discovered by @ifreund.
push time in 11 hours
PR merged ziglang/zig
No test case because I couldn't reduce the huuuge test case. Fixes the problem discovered by @ifreund.
pr closed time in 11 hours
Pull request review commentziglang/zig
stage1: Force union member types to be resolved
static Error resolve_union_zero_bits(CodeGen *g, ZigType *union_type) { union_type->abi_size = SIZE_MAX; union_type->size_in_bits = SIZE_MAX; }- union_type->data.unionation.resolve_status = zero_bits ? ResolveStatusSizeKnown : ResolveStatusZeroBitsKnown;++ if (zero_bits) {+ // Don't forget to resolve the types for each union member even though+ // the type is zero sized.+ // XXX: Do it in a nicer way in stage2.+ union_type->data.unionation.resolve_loop_flag_other = true;++ for (uint32_t i = 0; i < field_count; i += 1) {+ TypeUnionField *union_field = &union_type->data.unionation.fields[i];+ ZigType *field_type = resolve_union_field_type(g, union_field);+ if (field_type == nullptr) {+ union_type->data.unionation.resolve_status = ResolveStatusInvalid;+ return ErrorSemanticAnalyzeFail;
Hmm this looks like it could cause a compile failure without a compile error message. Does there need to be a compile error emitted here?
comment created time in 11 hours
Pull request review commentziglang/zig
Change how u8 slices/array are formatted with {}
pub fn generateBuiltinZigSource(comp: *Compilation, allocator: *Allocator) ![]u8 \\pub const arch = Target.current.cpu.arch; \\/// Deprecated \\pub const endian = Target.current.cpu.arch.endian();- \\pub const output_mode = OutputMode.{};- \\pub const link_mode = LinkMode.{};+ \\pub const output_mode = OutputMode.{s};+ \\pub const link_mode = LinkMode.{s};
All the {s} in generateBuiltinZigSource should be {z}.
comment created time in 13 hours
issue commentziglang/zig
It's good to know that xor is just not-equal while xnor is equals.
Actually, I believe using and, or, xor and a combination of negating inputs and negating outputs gives the full set of two variable Boolean functions, other than the trivial ones like all-zeros and all-ones. With a few redundant ways of doing things.
Some of the more useful ones:
A nand B = not ( A and B ) = not(A) and not(B)
A nor B = not( A or B ) = not(A) and not(B)
A implies B = not(A) or B
comment created time in 14 hours
pull request commentziglang/zig
stage1: Force union member types to be resolved
Still no luck isolating a test case for this, I can't even seem to trigger it using zig-wayland outside of river.
comment created time in 17 hours
issue commentziglang/zig
Proposal: Stack-Capturing Macro
@cajw1 Stripping a few caracters to aim for a "neater" syntax would empoverish the conveyed semantics and in fine, make the intent less clear.
The surely more verbose form you consider to be ugly make it nevertheless obvious (i.e. more readable) for the user which value would be returned from the labelled block whereas the latter syntax (=> {}) lost the perceptual cue that a value would even be returned.
Consequently, the user could lost focus for a moment and may need to review the entire block to grasp its logic.
comment created time in 18 hours
pull request commentziglang/zig
Add basic support for System V shm
@LemonBoy Where would you like the wrapper around linux/BSD shm (that chooses the correct syscall & translates errors) to be until the os.zig situation is resolved?
comment created time in 19 hours
issue commentziglang/zig
stage2: code signing in self-hosted MachO linker (arm64)
FYI, #7231 brings this one home!
comment created time in 19 hours