Skip to content

type is incorrent for windows' version nanosleep  #16410

@jiacai2050

Description

@jiacai2050

Zig Version

0.11.0-dev.3971+6bc9c4f71

Steps to Reproduce and Observed Behavior

const std = @import("std");

pub fn main() !void {
    std.os.nanosleep(1, 0);
}

Compile file above with

zig build-exe -target x86_64-windows test.zig 

Following error will be thrown

/Users/jiacai/.zig/zig-macos-aarch64-0.11.0-dev.3971+6bc9c4f71/lib/std/os.zig:5324:50: error: expected type 'c_long', found 'isize'
        .tv_nsec = math.cast(isize, nanoseconds) orelse math.maxInt(isize),
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/jiacai/.zig/zig-macos-aarch64-0.11.0-dev.3971+6bc9c4f71/lib/std/os.zig:5324:50: note: signed 32-bit int cannot represent all possible signed 64-bit values
referenced by:
    main: test.zig:4:11
    callMain: /Users/jiacai/.zig/zig-macos-aarch64-0.11.0-dev.3971+6bc9c4f71/lib/std/start.zig:608:32
    remaining reference traces hidden; use '-freference-trace' to see all reference traces


Expected Behavior

No error

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorstandard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions