shared arrays definition

Hello

Tell me plz, what difference between these code’s samples:

__shared__ int arr[512]; 

__global__ void myroutine() {

 //....//

}

and

__global__ void myroutine() {

__shared__ int arr[512]; 

 //....//

}

What differences in definition it inside or outside kernel?

Thanks

Usually when defining pointer to shared memory outside the kernel function means that You want dynamic shared memory allocation (one of the kernel call parameter, as far as I remember). But in such case it would look like this:

__shared__ extern int arr[];

Thus, I really don’t know should there be a formal diffrence between the definitions You mentioned. Is CUDA C Programming Guide not refering to the issue?

Regards,

MK