Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: JuliaLang/julia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3238b36aa86466d1dd8faa3f07760a6acf35036c
Choose a base ref
..
head repository: JuliaLang/julia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 36dffc33ebee4be0d39393936c7a22d151a39070
Choose a head ref
Showing with 11 additions and 11 deletions.
  1. +6 −6 doc/src/manual/handling-operating-system-variation.md
  2. +5 −5 doc/src/stdlib/base.md
12 changes: 6 additions & 6 deletions doc/src/manual/handling-operating-system-variation.md
Original file line number Diff line number Diff line change
@@ -2,29 +2,29 @@

When dealing with platform libraries, it is often necessary to provide special cases for various
platforms. The variable `Sys.KERNEL` can be used to write these special cases. There are several
functions intended to make this easier: `is_unix`, `is_linux`, `is_apple`, `is_bsd`, and `is_windows`.
functions intended to make this easier: `isunix`, `islinux`, `isapple`, `isbsd`, and `iswindows`.
These may be used as follows:

```julia
if is_windows()
if iswindows()
some_complicated_thing(a)
end
```

Note that `is_linux` and `is_apple` are mutually exclusive subsets of `is_unix`. Additionally,
Note that `islinux` and `isapple` are mutually exclusive subsets of `isunix`. Additionally,
there is a macro `@static` which makes it possible to use these functions to conditionally hide
invalid code, as demonstrated in the following examples.

Simple blocks:

```
ccall( (@static is_windows() ? :_fopen : :fopen), ...)
ccall((@static iswindows() ? :_fopen : :fopen), ...)
```

Complex blocks:

```julia
@static if is_linux()
@static if islinux()
some_complicated_thing(a)
else
some_different_thing(a)
@@ -35,5 +35,5 @@ When chaining conditionals (including if/elseif/end), the `@static` must be repe
level (parentheses optional, but recommended for readability):

```julia
@static is_windows() ? :a : (@static is_apple() ? :b : :c)
@static iswindows() ? :a : (@static isapple() ? :b : :c)
```
10 changes: 5 additions & 5 deletions doc/src/stdlib/base.md
Original file line number Diff line number Diff line change
@@ -188,11 +188,11 @@ Base.@elapsed
Base.@allocated
Base.EnvHash
Base.ENV
Base.is_unix
Base.is_apple
Base.is_linux
Base.is_bsd
Base.is_windows
Base.isunix
Base.isapple
Base.islinux
Base.isbsd
Base.iswindows
Base.Sys.windows_version
Base.@static
```