C99標準のキーワードを使用するだけrestrict
で、おそらく#define
それを他の何かに使用できます。
たとえば、次のように C99 への準拠をテストできます。
#if __STDC__ != 1
# error not conforming
# define restrict __restrict /* use implementation __ format */
#else
# ifndef __STDC_VERSION__
# error not conforming
# define restrict __restrict /* use implementation __ format */
# else
# if __STDC_VERSION__ < 199901L
# error Compiler for C before C99
# define restrict __restrict /* use implementation __ format */
# else
# /* all ok */
# endif
# endif
#endif
int fx(int *restrict a, char *restrict b) {
*b = *a;
return 0;
}
int main(void) {
int a[1];
char b[1];
fx(a, b);
return 0;
}
もちろん、#error
は作業バージョンで編集する必要があります