bug-autoconf
[Top][All Lists]
Advanced

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

RE: test for restrict fails with MS compiler


From: Jerker Bäck
Subject: RE: test for restrict fails with MS compiler
Date: Wed, 18 Jul 2007 14:31:50 +0200

Hello Ralf,

First, I feel I need to explain the basic problem. There is at this moment
just two compilers for x86_64 PE: The Intel and the MS compilers. The Intel
Compiler is said to be ISO C99-conforming. However, this compiler produce
applications with special start-up routines (from libirc.lib) that rely on
Win32 library functions (e.g. VirtualAlloc, LoadLibrary) and thus cannot be
used to produce POSIX applications. GCC for x86_64 PE is said to be far away
(x86_64-*-mingw status?). Which leave us with the MS compiler as the only
possible choice. It seems to me that C99 have had low priority compared with
performance and new C++ features among the developers of the MS compiler.
But, one of the few things they actually did implement is the C99 restrict
keyword. I quote MSDN again:
"The __restrict keyword is similar to restrict from the C99 spec, but
__restrict can be used in C++ or C programs".

> 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?

Kind of "better safe then sorry" approach. I wonder, what is the impact of
ignoring the restrict keyword?

> 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 
> bug.

I see, you are probably right in a technical sense. However, it doesn't help
at all. Why not lighten the strict requirement for C99 for better
portability?

By the way:
Intel(R) C++ Compiler for Intel(R) 64, version 10.0.025 => test OK.
As I mentioned, it works in Windows but cannot link properly in POSIX.

Regards Jerker






reply via email to

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