This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

restrict Keyword



Hi I'm unable to use Restrict keyword in C++.

Is there any altenative for the same?

 

Thanks

Veena

  • Veena,

    In what exactly way you are unable to use the keyword? Does it throw a compile error or an issue manifests in runtime?

    I can't think of any alternatives, since this keyword is used only for optimization purposes.

    Regards,

    Rafael

  • Veena KK said:

    Hi I'm unable to use Restrict keyword in C++.

    Is there any altenative for the same?

    No.  While there are several scenarios under which use of restrict is not legal, the most common is that two different pointer variables are operating upon the same array.  In that case, you have to change the code so that the two different pointer variables are always operating upon different arrays.  Then you can apply restrict.  For more background on restrict, please see this wiki article.

    Thanks and regards,

    -George