# Do \`@propagate\_inbounds\` stack together?

**URL:** <https://discourse.julialang.org/t/do-propagate-inbounds-stack-together/52996>\
**Category:** General Usage\
**Created:** [January 7, 2021, 4:31pm UTC](https://discourse.julialang.org/t/do-propagate-inbounds-stack-together/52996 "2021-01-07T16:31:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gregstrq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gregstrq/32/20620_2.png) [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Post date:** [January 7, 2021, 4:31pm UTC](https://discourse.julialang.org/t/do-propagate-inbounds-stack-together/52996/1 "2021-01-07T16:31:08Z")

</div>

The documentation says that `@propagate_inbounds` add additional layer of inlining for eliding `@boundscheck` blocks. That means, that if you have more than two levels of inlining, eliding does not work.

If the function at each level of inlining is decorated with `@propagate_inbounds`, does it allow to extend the maximum level of inlining for eliding `@boundscheck` blocks indefinitely? Or, paraphrasing it, do `@propagate_inbounds` stack together?

The reason I am asking is the following. Besides the default style of indexing to my custom structures, I would like to add additional style of indexing. To keep it simple, I want first to transform the index to default style and then to call the existing `getindex` implementation which actually performs the boundschecking. But the transformation adds additional layers of inlining to the boundschecking.

Also, another question.  
If I use @propagate\_inbounds macro, do I need to use @inline macro for the function definition, or the former includes the latter under the hood?

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [January 7, 2021, 5:17pm UTC](https://discourse.julialang.org/t/do-propagate-inbounds-stack-together/52996/2 "2021-01-07T17:17:10Z")

</div>

> Or, paraphrasing it, do `@propagate_inbounds` stack together?

Yes.

> If I use `@propagate_inbounds` macro, do I need to use `@inline` macro for the function definition

No.
