views:

116

answers:

1

I found the CompilationRelaxations attribute on an assembly when looking at it in Reflector. This link says that the attribute specifies whether:

Optimizers are granted additional latitude for relaxed exceptions.

What are relaxed exceptions and what does the compiler do given its "additional latitude" with them.

+4  A: 

This allows the compiler to have more flexibility in it's optimization.

See the help for the CompilationRelaxations enum for details.

--- EDIT ---

At this point, there is a single enum that attribute uses, with only 1 option: NoStringInterning

From the MSDN help, this:

Marks an assembly as not requiring string-literal interning.

In an application domain, the common language runtime creates one string 
object for each unique string literal, rather than making multiple copies.
This behavior, called string interning, internally requires building 
auxiliary tables that consume memory resources. 

This attribute is specified to use an enum, though, so more options can easily be added later. This is the only optimization allowed via this assembly attribute right now, though.

Reed Copsey
Huh, that enum has only one value: NoStringInterning
Jonathan Parker
At this time, there is only one option for that attribute :) They used an enum to leave it open for extension later while maintaining compatibility.
Reed Copsey
Why would the compiler automatically set NoStringInterning on the assemlby? I didn't set it myself.
Jonathan Parker
The compiler won't do this, unless you explicitly set this attribute. If you set it, the compiler has the option (but isn't guaranteed) to disable string interning.
Reed Copsey