# Removing bound checks globally in an interactive session

**URL:** <https://discourse.julialang.org/t/removing-bound-checks-globally-in-an-interactive-session/6998>\
**Category:** General Usage\
**Created:** [November 10, 2017, 8:17pm UTC](https://discourse.julialang.org/t/removing-bound-checks-globally-in-an-interactive-session/6998 "2017-11-10T20:17:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Snir\_Gazit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/snir_gazit/32/11027_2.png) [@Snir\_Gazit](https://discourse.julialang.org/u/Snir_Gazit)\
**Post date:** [November 10, 2017, 8:17pm UTC](https://discourse.julialang.org/t/removing-bound-checks-globally-in-an-interactive-session/6998/1 "2017-11-10T20:17:29Z")

</div>

Does starting an interactive session (or an IJulia notebook from that session) using the command line option “–check-bounds=no” really eliminate all boundary checks across the entire code?

For instance, the following session indicates that a boundary check is still performed.

```julia
MacBook-Pro-10:spt snirgaz$ /Applications/Julia-0.6.app/Contents/Resources/julia/bin/julia --check-bounds=no
               _
   _ _ _(_)_ | A fresh approach to technical computing
  (_) | (_) (_) | Documentation: https://docs.julialang.org
   _ _ _| |_ __ _ | Type "?help" for help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 0.6.0 (2017-06-19 13:05 UTC)
 _/ |\ __'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-apple-darwin13.4.0

julia> a=[1,2,3]
3-element Array{Int64,1}:
 1
 2
 3

julia> a[4]
ERROR: BoundsError: attempt to access 3-element Array{Int64,1} at index [4]
Stacktrace:
 [1] getindex(::Array{Int64,1}, ::Int64) at ./array.jl:520

```

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [November 11, 2017, 11:58pm UTC](https://discourse.julialang.org/t/removing-bound-checks-globally-in-an-interactive-session/6998/2 "2017-11-11T23:58:44Z")

</div>

Put it in a function.

```julia
julia> f(a) = a[4];

julia> a = [1,2,3];

julia> f(a)
0

julia> a[4]
ERROR: BoundsError: attempt to access 3-element Array{Int64,1} at index [4]
...

```

---

<div class="post-metadata">

**Author:** ![Snir\_Gazit](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/snir_gazit/32/11027_2.png) [@Snir\_Gazit](https://discourse.julialang.org/u/Snir_Gazit)\
**Post date:** [November 12, 2017, 5:22am UTC](https://discourse.julialang.org/t/removing-bound-checks-globally-in-an-interactive-session/6998/3 "2017-11-12T05:22:08Z")

</div>

Thanks!
