Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mzji opened this issue May 1, 2017 · 3 comments
Closed

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

mzji opened this issue May 1, 2017 · 3 comments

Comments

@mzji
Copy link

mzji commented May 1, 2017

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.)

@retep998
Copy link
Member

retep998 commented May 1, 2017

@frewsxcv Since you wrote that example in #38397, care to explain why you wrote it like that? 😛

@frewsxcv
Copy link
Member

frewsxcv commented May 1, 2017

woops, that's just a typo. Feel free to submit a pull request, or I can later

@frewsxcv
Copy link
Member

frewsxcv commented May 2, 2017

opened a pr: #41688

frewsxcv added a commit to frewsxcv/rust that referenced this issue May 2, 2017
…=sfackler

Fix incorrect hex value in doc comment example.

Fixes rust-lang#41682.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants