By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 697 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

C2485 __declspec(restrict)

P: n/a
Hi,

I'm having a very strange problem with VC8

When compiling a library called gmp (v 4.1.4); with win32 patches applied
for VC7 (VC8 is not directly supported yet), I get this error all over
pretty much every system header:

C2485 __restrict__ is an invalid attribute.

The offending code, in places like malloc.h, stdlib.h, etc,
contains the macro _CRTRESTRICT, which is defined in crtdefs.h as
__declspec(restrict)

But that attribute _is_ valid....

Any ideas?

TIA

Fernando Cacciola



Mar 22 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
> Hi,

I'm having a very strange problem with VC8

When compiling a library called gmp (v 4.1.4); with win32 patches applied
for VC7 (VC8 is not directly supported yet), I get this error all over
pretty much every system header:

C2485 __restrict__ is an invalid attribute.

The offending code, in places like malloc.h, stdlib.h, etc,
contains the macro _CRTRESTRICT, which is defined in crtdefs.h as
__declspec(restrict)

But that attribute _is_ valid....

Any ideas?

TIA

Fernando Cacciola


Hi,

I noticed that in your error message, restrict is surrounded by 2
underscores on each side.
if I compile this:

__declspec(restrict) char * rfun();
it copiles just fine, but if I try this:
__declspec(__restrict__) char * rfun();

I too get
error C2485: '__restrict__' : unrecognized extended attribute

Which leads me to believe that somehow your declspecs get mangled since
__restrict__ really is invalid.

You said that VC8 was not yet explicitly supported by that toolkit.
restrict was not yet known by VC7.1.
Could it be that a macro definition is wreaking havoc?

If that is the case then you can find this out by looking at the
preprocessed output and checking
what gets changed because ot which definitions.

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"
Mar 22 '06 #2

P: 1
C2485 __restrict__ is an invalid attribute.

had nearly the same problem:

error C2485: '__restrict' : unrecognized extended attribute

the reason for this error was, in another header restrict was defined to __restrict:

#define restrict __restrict

so because of that the keyword was: __declspec(__restrict)
but had to be: __declspec(restrict)

undefiing restrict solved the problem.

Gruss
May 23 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.