Results 1 to 2 of 2

Thread: Memory space clarification

  1. #1

    Memory space clarification

    Hello, can someone please help me out with the following code:
    Code :
    float __constant (*arr)[2][1];

    I need to know where this points to exactly.
    My guess would be that arr is a private pointer to a private pointer to the constant memory space. But the NVIDIA implementation just seems to have arr, *arr, **arr all point to the constant memory space.
    Which is the correct answer?

    Thanks in advance!

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: Memory space clarification

    Although I'm not a language lawyer I will try to answer your question since nobody has done it yet.

    This variable declaration:

    Code :
    float __constant (*arr)[2][1];

    means that "arr" is an array of pointers to __constant memory. The pointers themselves are located in private memory (assuming that the variable declaration occurs in kernel scope).

    This is not any different from the way that this other variable declaration works:

    Code :
    __constant float *myPtr;

    In this case we also have a pointer variable in private memory that points to an address in __constant memory.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

Similar Threads

  1. Replies: 1
    Last Post: 01-24-2013, 12:47 AM
  2. Replies: 3
    Last Post: 01-28-2010, 12:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •