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

Add missing code formatting in Docs/Bounds checking section #49983

Merged
merged 1 commit into from
May 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions doc/src/devdocs/boundscheck.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ end
With a custom array-like type `MyArray` having:

```julia
@inline getindex(A::MyArray, i::Real) = (@boundscheck checkbounds(A,i); A.data[to_index(i)])
@inline getindex(A::MyArray, i::Real) = (@boundscheck checkbounds(A, i); A.data[to_index(i)])
```

Then when `getindex` is inlined into `sum`, the call to `checkbounds(A,i)` will be elided. If
Then when `getindex` is inlined into `sum`, the call to `checkbounds(A, i)` will be elided. If
your function contains multiple layers of inlining, only `@boundscheck` blocks at most one level
of inlining deeper are eliminated. The rule prevents unintended changes in program behavior from
code further up the stack.
Expand All @@ -57,7 +57,7 @@ with [`OffsetArrays`](@ref man-custom-indices):
```julia-repl
julia> using OffsetArrays

julia> sum(OffsetArray([1,2,3], -10))
julia> sum(OffsetArray([1, 2, 3], -10))
9164911648 # inconsistent results or segfault
```

Expand Down Expand Up @@ -123,4 +123,4 @@ the last argument).

## Emit bounds checks

Julia can be launched with `--check-bounds={yes|no|auto}` to emit bounds checks always, never, or respect @inbounds declarations.
Julia can be launched with `--check-bounds={yes|no|auto}` to emit bounds checks always, never, or respect `@inbounds` declarations.