Skip to content

attribute/cfg: What values are set by default? #446

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

Closed
kornelski opened this issue Feb 8, 2015 · 2 comments
Closed

attribute/cfg: What values are set by default? #446

kornelski opened this issue Feb 8, 2015 · 2 comments

Comments

@kornelski
Copy link
Contributor

The example only shows "linux", but what values are set on other platforms?

How can I check what's my platform's name according to Rust?

Is there a way to target all Unix platforms? (OS X, FreeBSD, etc.)

Is there a way to target x86 and ARM?

@mdinger
Copy link
Contributor

mdinger commented Feb 8, 2015

This seems to be documented under Reference/conditional compilation. Looks like you'd use:

#[cfg(any(target_os = "linux", target_os = "freebsd"))]
fn needs_linux_or_freebsd() {}

How nesting is applied isn't completely clear though it states you can.

@mdinger
Copy link
Contributor

mdinger commented Feb 8, 2015

Ah, target_family looks like what you need.

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

2 participants