Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This clause is informative.
B.1 General
This annex collects some information about portability that appears in this specification.
B.2 Undefined behavior
The behavior is undefined in the following circumstances:
- The behavior of the enclosing async function when an awaiterโs implementation of the interface methods
INotifyCompletion.OnCompletedandICriticalNotifyCompletion.UnsafeOnCompleteddoes not cause the resumption delegate to be invoked at most once (ยง12.9.9.4). - Passing pointers as
reforoutparameters (ยง24.3.2). - When dereferencing the result of converting one pointer type to another and the resulting pointer is not correctly aligned for the pointed-to type. (ยง24.5.1).
- When the unary
*operator is applied to a pointer containing an invalid value (ยง24.6.2). - When a pointer is subscripted to access an out-of-bounds element (ยง24.6.4).
- When comparing values of funcptr_types, or
void*copies thereof (ยง24.6.8. - Modifying objects of managed type through fixed pointers (ยง24.7).
- The content of memory newly allocated by
stackalloc(ยง12.8.22). - Attempting to allocate a negative number of items using
stackalloc(ยง12.8.22). - Implicit dynamic conversions (ยง10.2.10) of input parameters with value arguments (ยง12.6.4.2).
B.3 Implementation-defined behavior
A conforming implementation is required to document its choice of behavior in each of the areas listed in this subclause. The following are implementation-defined:
- The handling of the Unicode NULL character (U+0000) in a compilation unit. (ยง6.1)
- The behavior when an identifier not in Normalization Form C is encountered. (ยง6.4.3)
- The maximum value allowed for
Decimal_Digit+inPP_Line_Indicator. (ยง6.5.8) - The interpretation of the input_characters in the pp_pragma-text of a #pragma directive. (ยง6.5.10)
- The values of any application parameters passed to the application entry-point method by the host environment prior to application startup. (ยง7.1)
- The mechanism for determining whether a program is compiled as a class library or as an application. (ยง7.1)
- The policy or mechanisms used by an implementation for the creation and destruction of application domains. (ยง7.1)
- The exit code if the application terminates due to an exception. (ยง7.1)
- Whether or not finalizers are run as part of application termination. (ยง7.1, ยง7.8)
- Whether APIs allow a finalizer to be run more than once. (ยง7.8)
- The size and value range of the types
nintandnuint. (ยง8.3.6) - The API surface provided by
Expression<TDelegate>beyond the requirement for aCompilemethod. (ยง8.6) - The precise structure of the expression tree, as well as the exact process for creating it, when an anonymous function is converted to an expression-tree. (ยง10.7.3)
- The reason a conversion to a compatible delegate type may fail at compile-time. (ยง10.7.3)
- The value returned when a stack allocation of size zero is made. (ยง12.8.22)
- Whether a
System.ArithmeticException(or a subclass thereof) is thrown or the overflow goes unreported with the resulting value being that of the left operand, when in anuncheckedcontext and the left operand of an integer division is the maximum negativeintorlongvalue and the right operand isโ1. (ยง12.13.3) - When a
System.ArithmeticException(or a subclass thereof) is thrown when performing a decimal remainder operation. (ยง12.13.4) - The mechanism for distinguishing a propertyโs set accessor signature from that of an init accessor (ยง15.3.10.2).
- The mechanism for distinguishing an indexerโs set accessor signature from that of an init accessor (ยง15.3.10.4).
- The impact of thread termination when a thread has no handler for an exception, and the thread is itself terminated. (ยง13.10.6)
- The mechanism by which linkage to an external method is achieved. (ยง15.6.8)
- The impact of thread termination when no matching
catchclause is found for an exception and the code that initially started that thread is reached. (ยง22.4). - The token name mapping and semantics of unmanaged calling conventions beyond those required by this specification, and the set of valid combinations of those tokens (ยง24.3.3).
- The order of execution of module initializers in a module (ยง23.5.11).
- An execution environment may provide additional attributes that affect the execution of a C# program. (ยง23.5.1)
- The mappings between pointers and integers. (ยง24.5.1)
- The effect of applying the unary
*operator to anullpointer. (ยง24.6.2) - The type of exception thrown when the primary_expression of an invocation_expression is a function pointer with value
null, and an attempt is made to invoke the (non-existent) pointed-to method (ยง12.8.10). - The behavior when pointer arithmetic overflows the domain of the pointer type. (ยง24.6.6, ยง24.6.7)
- The result of the
sizeofoperator for non-pre-defined value types. (ยง24.6.9) - The behavior of the
fixedstatement if the array expression isnullor if the array has zero elements. (ยง24.7) - The behavior of the
fixedstatement if the string expression isnull. (ยง24.7) - The value returned when a stack allocation of size zero is made (ยง12.8.22).
B.4 Implementation-specific behavior
The behaviors listed in this subclause need not be documented. The following are implementation-specific:
- How a nullable context is specified external to the source code to which it applies. (ยง8.9.4.1)
B.5 Unspecified behavior
- The name of the entry-point method generated to contain top-level statements (ยง7.1.3).
- The time at which the finalizer (if any) for an object is run, once that object has become eligible for finalization (ยง7.8).
- The representation of
true(ยง8.3.9). - The value of the result when converting out-of-range values from
floatordoublevalues to an integral type in anuncheckedcontext (ยง10.3.2). - The exact target object and target method of the delegate produced from an anonymous_method_expression contains (ยง10.7.2).
- The layout of arrays, except in an unsafe context (ยง12.8.17.4).
- Whether there is any way to execute the block of an anonymous function other than through evaluation and invocation of the lambda_expression or anonymous_method-expression (ยง12.22.3).
- The exact timing of static field initialization (ยง15.5.6.2).
- The result of invoking
MoveNextwhen an enumerator object is running (ยง15.15.5.2). - The result of accessing
Currentwhen an enumerator object is in the before, running, or after states (ยง15.15.5.3). - The result of invoking
Disposewhen an enumerator object is in the running state (ยง15.15.5.4). - The attributes of a type declared in multiple parts are determined by combining, in an unspecified order, the attributes of each of its parts (ยง23.3).
- The order in which members are packed into a struct (ยง24.6.9).
- An exception occurs during finalizer execution, and that exception is not caught (ยง22.4).
- If more than one member matches, which member is the implementation of
I.M(ยง19.6.5).
B.6 Other issues
- The exact results of floating-point expression evaluation can vary from one implementation to another, because an implementation is permitted to evaluate such expressions using a greater range and/or precision than is required (ยง8.3.7).
- Certain signatures are reserved for compatibility with other programming languages (ยง15.3.10).
End of informative text.
ECMA C# draft specification