[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: Fri, 13 Jul 2007 08:07:19 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

Hello Jerker,

* Jerker Bäck wrote on Tue, Jul 10, 2007 at 06:23:21PM CEST:
> Hello Ralf,
> > That would be a bug in MSVC, right?
> Generally speaking, the error have not so much to do with the restrict
> keyword. This only affects when you typedef a custom type and later try to
> change its behaviour. The MS compiler is known to look deep when preprocess
> and make warnings or errors according to certain rules. The limitation here
> is probably intentional, not a bug. My comment on this was only that I agree
> with the compiler. Don't you?

No, I don't.  ISO C99 allows to add type qualifiers directly as well as
indirectly via typedefs.  For example, in 6.7.3(4) it says:

| If the same qualifier appears more than once in the same
| specifier-qualifier-list, either directly or via one or more typedefs,
| the behavior is the same as if it appeared only once.

And the Syntax in 6.7(1) is quite clear in that a type-qualifier (such
as restrict) can appear in addition to a type-specifier (such as a
typedef name).

So IMVHO the Autoconf test is just prudent in detecting this compiler

> In the real world, GNU regex is using the restrict keyword in its
> prototypes:
> extern int __cdecl regcomp (re_pattern_buffer_t* __restrict, const char*
> __restrict, int);
> - Works for me. Note the difference from the test declarations.
> Anyway, if autoconf wish to support the MS compiler, the change in the test
> is simple.

Is there a misunderstanding here?  Autoconf supports MSVC wrt. restrict:
it will add
  #define restrict

to config.h which will cause code like in the configure test to be
compiled successfully by MSVC, no?

Hope this clears things up.

> FYI the environment is x86_64 Interix 6 (Vista x64 SUA) AFAIK the restrict
> keyword is not supported for MS compilers < 1400 I will test with the Intel
> compiler to see if there are any differences. My icc shell script is not
> quite ready though.

That would be good in any case, independently of the above.  Thanks.


reply via email to

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