Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions standard/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -3201,15 +3201,15 @@ The `typeof` operator can be used on a type parameter. It is a compile time erro

### 12.8.19 The sizeof operator

The `sizeof` operator returns the number of 8-bit bytes occupied by a variable of a given type. The type specified as an operand to sizeof shall be an *unmanaged_type* ([§8.8](types.md#88-unmanaged-types)).
The `sizeof` operator returns the number of 8-bit bytes occupied by a variable of a given type.

```ANTLR
sizeof_expression
: 'sizeof' '(' unmanaged_type ')'
;
```

For certain predefined types the `sizeof` operator yields a constant `int` value as shown in the table below:
For certain types the `sizeof` operator yields a constant `int` value as shown in the table below:

|**Expression** | **Result** |
|----------------- | ---------- |
Expand All @@ -3227,7 +3227,9 @@ For certain predefined types the `sizeof` operator yields a constant `int` value
|`sizeof(bool)` | 1 |
|`sizeof(decimal)` | 16 |

For an enum type `T`, the result of the expression `sizeof(T)` is a constant value equal to the size of its underlying type, as given above. For all other operand types, the `sizeof` operator is specified in [§24.6.9](unsafe-code.md#2469-the-sizeof-operator).
For an enum type `T`, the result of the expression `sizeof(T)` is a constant value equal to the size of its underlying type, as given above.

For all other operand types, the `sizeof` operator is specified in [§24.6.9](unsafe-code.md#2469-the-sizeof-operator), and is allowed only in an unsafe context.

### 12.8.20 The checked and unchecked operators

Expand Down
2 changes: 1 addition & 1 deletion standard/unsafe-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ Because an implicit conversion exists from any pointer type to the `void*` type,

### 24.6.9 The sizeof operator

For certain predefined types ([§12.8.19](expressions.md#12819-the-sizeof-operator)), the `sizeof` operator yields a constant `int` value. For all other types, the result of the `sizeof` operator is implementation-defined and is classified as a value, not a constant.
For certain types ([§12.8.19](expressions.md#12819-the-sizeof-operator)), the `sizeof` operator yields a constant `int` value. For 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.

Expand Down
Loading