View source code
Display the source code in std/system.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

std.system.OS/os - multiple declarations

Variable os

The OS that the program was compiled for.

immutable(OS) os = OS.linux;

Enum OS

Operating system.

enum OS : int { ... }

Enum members

NameDescription
android Android
dragonFlyBSD DragonFlyBSD
freeBSD FreeBSD
iOS iOS
linux All Linux Systems, except for Android
netBSD NetBSD
osx Mac OS X
otherPosix Other Posix Systems
solaris Solaris
tvOS tvOS
unknown Unknown
watchOS watchOS
win32 Microsoft 32 bit Windows systems
win64 Microsoft 64 bit Windows systems

Note

This is for cases where you need a value representing the OS at runtime. If you're doing something which should compile differently on different OSes, then please use version (Windows), version (linux), etc.

See Also

Predefined Versions

Authors

Walter Bright and Jonathan M Davis

License

Boost License 1.0.