C3842

  • Thread starter Thread starter Daniel =?iso-8859-1?Q?Lidstr=F6m?=
  • Start date Start date
D

Daniel =?iso-8859-1?Q?Lidstr=F6m?=

What is the reason for C3842?
'function': 'const' and 'volatile' qualifiers on member functions of
managed types are not supported
 
Daniel Lidström said:
What is the reason for C3842?
'function': 'const' and 'volatile' qualifiers on member functions of
managed types are not supported

The CLR just doesn't have the concept of const or volatile except for
fields.
 
Daniel Lidström said:
Isn't this a compile-time issue?

Not really. Unless the CLR has some concept of "constness", it won't be
in the assembly format, which means you wouldn't be able to use it when
compiling against other libraries.

You could have constness for internal methods and types (if C# had such
a concept, which it doesn't) but it wouldn't be very elegant to be so
restricted.
 
Jon Skeet said:
You could have constness for internal methods and types (if C# had such
a concept, which it doesn't) but it wouldn't be very elegant to be so
restricted.

Ignore this part of my post - presumably you're working in MC++ rather
than C#?

I still think it wouldn't be terribly elegant to have constness for
internal things but not publicly visible things.
 
Back
Top