[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test for restrict fails with MS compiler

From: Ralf Wildenhues
Subject: Re: test for restrict fails with MS compiler
Date: Tue, 10 Jul 2007 17:08:08 +0200
User-agent: Mutt/1.5.16 (2007-07-04)

Hello Erik,

* Jerker Bäck wrote on Tue, Jul 10, 2007 at 03:28:33PM CEST:
> The MS compiler fails the test for the __restrict keyword
> Like this:
>     typedef int * int_ptr;
>     int foo (int_ptr __restrict ip)      // C2219: syntax error
> But this works OK:
>     typedef int * __restrict int_ptr;
>     int foo (int_ptr ip)                // OK
> which make sense - not allowing change of a defined custom type

I don't understand the reasoning here.  AFAIK, ISO C99 allows the first
two lines (with 'restrict' instead of '__restrict', of course).  MSVC
rejects them.  That would be a bug in MSVC, right?  And if yes, then
it's only prudent that Autoconf detects this bug and disables restrict,
right?  Because that will enable your code to be built without error.
AFAIR the AC_C_RESTRICT macro was explicitly changed to catch a similar
compiler bug (for some HP-UX compiler).

Autoconf shouldn't force its users to not write decent code like
  typedef int * int_ptr;
  int foo (int_ptr restrict ip)

just because MSVC is buggy, no?  But maybe I have misunderstood you.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]