Various patches against gmp-4.3.0
Niels Möller
nisse at lysator.liu.se
Wed May 6 10:08:42 CEST 2009
Michiel De Wilde <mdewilde.agilent at googlemail.com> writes:
> A #define always changes a name on a global scope level. On Windows, some
> win32 headers that get included use __declspec(restrict), which is now
> changed to __declspec(__restrict), which is invalid. The problem does not
> occur if you include the project name into the identifier that is being
> redefined: "#define GMP_RESTRICT __restrict" instead of "#define restrict
> __restrict" (and replace "restrict" by "GMP_RESTRICT" in the code).
This is still confusing. As long as the windows headers and the gmp
redefinition of restrict are not included in the same compilation
unit, there should be no problem, right? In which compilation unit do
you include both gmp's redefinition, and windows headers?
It's common practice in autoconf projects to redefine C keywords when
necessary, and to do, e.g.,
#if !CONST_SUPPORTED
#define const
#endif
rather than
#if CONST_SUPPORTED
#define GMP_CONST const
#else
#define GMP_CONST
#endif
This reduces clutter in the code that uses the keyword.
Regards,
/Niels
More information about the gmp-devel
mailing list