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

Max Horn max at quendi.de
Fri Aug 27 10:16:04 CEST 2004


Am 27.08.2004 um 18:59 schrieb Jamieson Christian:

> Yo, folks.
>
> I just got around to doing my periodic "let's see if MSVC6 still  
> compiles
> ScummVM" build. Got everything cleaned up except for the new scaler  
> code,
> which always gives MSVC6 fits. It seems the latest optimizations are  
> using
> the __restrict__ keyword, which is C99 standard but not C++ standard,  
> and
> furthermore is not supported by MSVC6.

Indeed.


> http://gcc.gnu.org/onlinedocs/gcc-3.2.1/gcc/Restricted-Pointers.html
> http://osl.iu.edu/~tveldhui/papers/techniques/ 
> techniques01.html#restrict.yo
> http://www.icancode.com/cpp/cdiffs.htm#C99-restrict
>
> For those compilers where __restrict__ is actually recognized a  
> reserved
> keyword, would an #ifdef be sufficient to discover that? The following  
> code
> is what I'm using to get it to compile in MSVC6, and I'm wondering if  
> it is
> adequate for general use.
>
> #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...


Bye,

Max





More information about the Scummvm-devel mailing list