Skip to content

The document of process exit code in std::process::exit() is wrong #41682

Closed
@mzji

Description

@mzji

The document said:

/// Due to [platform-specific behavior], the exit code for this example will be
/// `0` on Linux, but `256` on Windows:
///
/// ```no_run
/// use std::process;
///
/// process::exit(0x0f00);
/// ```

However from the text above, line process::exit(0x0f00); should be changed to process::exit(0x0100); . On Windows, all 32 bits of the exit code is available. See the document of ExitProcess() for more details. (The parameter of ExitProcess() is a UINT, which maps to a C unsigned int on Windows platforms, which usually is a 32-bit unsigned integer today. The 32-bit 0x0f00 is 3840, not 256.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions