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

Jamieson Christian jamiesonc at tds.net
Fri Aug 27 10:01:38 CEST 2004


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.

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.

    -- Jamieson Christian (sf.net: Jamieson630)





More information about the Scummvm-devel mailing list