`@inbounds` applies to everything that follows. You should even be able to 
apply it to a module at once, or to use `begin`...`end` to apply it to several 
statements at once. `@fastmath` behaves in a similar manner.

`@simd`, however, needs to be applied directly to a single loop.

-erik

> On Jan 20, 2015, at 11:37 , Jacob Quinn <[email protected]> wrote:
> 
> That all seems correct to me.
> 
> -Jacob
> 
> On Tue, Jan 20, 2015 at 9:36 AM, Nils Gudat <[email protected]> wrote:
> Just a quick clarification on the @inbounds macro: I've seen it used both 
> before and inside loops, like:
> 
> @inbounds for i = 1:1000
>   a = x[i]
>   b = z[i]
> end
> 
> inbounds for i = 1:1000
>   @inbounds a = x[i]
>   @inbounds b = z[i]
> end
> 
> Would I be correct in assuming that both usages are valid and working and 
> that the choice between the two basically boils down to whether I want to 
> turn off bounds checking inside the entire loop (first case) or only for 
> certain lines within the loop (second case)?

--
Erik Schnetter <[email protected]>
http://www.perimeterinstitute.ca/personal/eschnetter/

My email is as private as my paper mail. I therefore support encrypting
and signing email messages. Get my PGP key from https://sks-keyservers.net.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to