13.07.2015 Views

C# Language Specification - Willy .Net

C# Language Specification - Willy .Net

C# Language Specification - Willy .Net

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>C#</strong> LANGUAGE SPECIFICATIONThe result of the sizeof operator is a value of type int. For certain predefined types, the sizeof operatoryields a constant value as shown in the table below.ExpressionResultsizeof(sbyte) 1sizeof(byte) 1sizeof(short) 2sizeof(ushort) 2sizeof(int) 4sizeof(uint) 4sizeof(long) 8sizeof(ulong) 8sizeof(char) 2sizeof(float) 4sizeof(double) 8sizeof(bool) 1For all other types, the result of the sizeof operator is implementation-defined and is classified as a value,not a constant.The order in which members are packed into a struct is unspecified.For alignment purposes, there may be unnamed padding at the beginning of a struct, within a struct, and atthe end of the struct. The contents of the bits used as padding are indeterminate.When applied to an operand that has struct type, the result is the total number of bytes in a variable of thattype, including any padding.25.6 The fixed statementIn an unsafe context, the embedded-statement (§15) production permits an additional construct, the fixedstatement, which is used to “fix” a moveable variable such that its address remains constant for the durationof the statement.embedded-statement:...fixed-statementfixed-statement:fixed ( pointer-type fixed-pointer-declarators ) embedded-statementfixed-pointer-declarators:fixed-pointer-declaratorfixed-pointer-declarators , fixed-pointer-declaratorfixed-pointer-declarator:identifier = fixed-pointer-initializerfixed-pointer-initializer:& variable-referenceexpressionEach fixed-pointer-declarator declares a local variable of the given pointer-type and initializes that localvariable with the address computed by the corresponding fixed-pointer-initializer. A local variable declaredin a fixed statement is accessible in any fixed-pointer-initializers occurring to the right of that variable’s328

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!