[Scummvm-devel] MSVC6 and the "restrict" keyword

David Eriksson david at scummvm.org
Fri Aug 27 13:04:06 CEST 2004


On Fri, 2004-08-27 at 21:34, Eugene Sandulenko wrote:
> Max Horn writes:
>  > > #ifndef __restrict__
>  > > #define __restrict__
>  > > #endif
>  > >
>  > > I placed this code at the top of scummvm/common/scaler/scale2x.cpp and
>  > > scummvm/common/scaler/scale3x.cpp.
>  > 
>  > That patch won't work; the preprocessor is not aware of language  
>  > keywords. The "proper" way is to check whether the compiler supports  
>  > this keyword in the configure script or so...
> The problem is that MSVC doesn't use configure script now. I think
> that no compiler except that which we used till moment has problems
> with __restrict__. So probably we could just add another define
> HAVE_RESTRICT__ which is always set to true in config.h, but MSVC will
> not use it.
> 
> With this approach above could would turn to:
> 
> #ifnded HAVE_RESTRICT__
> #define __restrict__
> #endif

Another alternative is to have the configure script define a variable
such as SCUMMVM_RESTRICT to __restrict__ if the compiler support it,
otherwise to nothing. After that, replace all __restrict__ in the source
code with SCUMMVM_RESTRICT.

-- 
-\- David Eriksson -/-                              www.2GooD.nu
 
"I personally refuse to use inferior tools because of ideology."
                                                - Linus Torvalds





More information about the Scummvm-devel mailing list