In the program I am coding, one of my function declarations goes like this:
bool parse( const sentence & __restrict sentence )
{
// whatever
}
When I compile the code with Microsoft Visual Studio 2010 Express, the compiler complains:
warning C4227: anachronism used : qualifiers on reference are ignored
However, this page of GCC’s documentation says:
In addition to allowing restricted pointers, you can specify restricted references, which indicate that the reference is not aliased in the local context.
And the same page gives a very explicit example:
void fn (int *__restrict__ rptr, int &__restrict__ rref)
{
/* ... */
}
Did I misunderstand MVSC’s warning? or should I transform all my references into pointers so that __restrict
applies?
__restrict
is a vendor extension, so you have to play by each vendor's rules. – Indonesian