문제

In the following example:

void foo (double *ptr)
{
     const double * restrict  const restr_ptr=ptr;
}

I get this error:

error: expected a ";"      const double * restrict  const restr_ptr=ptr;
                                                      ^

I compile with -std=c99, using gcc 3.4

Any Ideas?

도움이 되었습니까?

해결책

In C++, restrict is not a keyword (except for Microsoft extensions). It doesn't mean what it does in C. It looks as though you tried to apply C99 mode to your C++ compiler. Use a C compiler to compile C code, and use a C++ compiler to compile C++. Neither language is a subset of the other.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top