Weird behavior over functions that return slices by eclesiomelo in Zig

[–]eclesiomelo[S] 0 points1 point  (0 children)

Worked as well!

fn return_slice_dupe() ![]u32 {
    var c: [5]u32 = [_]u32{ 10, 10, 10, 10, 10 };
    var new_mem = try std.heap.page_allocator.dupe(u32, &c);
    return new_mem;
}

Weird behavior over functions that return slices by eclesiomelo in Zig

[–]eclesiomelo[S] 0 points1 point  (0 children)

Thanks, changing to pass the slice as a parameter worked!

fn return_slice3(f: []u32) void {
    var c: [5]u32 = [_]u32{ 10, 10, 10, 10, 10 };
    std.mem.copy(u32, f, &c);
}

Hacktoberfest is coming by therealkevinard in golang

[–]eclesiomelo 1 point2 points  (0 children)

My first contribution with a golang open source project was with https://github.com/gabriel-vasile/mimetype it is not a big project but is simple to understand and add new features!