Hi,
I'm trying to use the C99 restrict keyword in my program, as documented here:
http://msdn.microsoft.com/en-us/library/5ft82fed(v=vs.80).aspx
But I'm having issues getting it to do the correct thing in some specific cases (it mostly works OK):
#define restrict __restrict
#include <stdlib.h>
int main(void) {
printf("Hello world!\n");
}
This fails to compile:
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\stdlib.h(598): error C2485: '__restrict' : unrecognized extended attribute
(and then that repeats for line 600, 602, 604, 606, 607, 609, 611, 613 and 615.)
Inverting the define and the include fixes it (and gives the expected behaviour if I were to actually use it in a meaningful way), but for larger existing codebases it seems like an unideal solution to have to redo the whole codebase to ensure that stdlib.h
is included before config.h in every single source file. Is this a bug, or expected and documented behaviour?