dotnet / dotnet/csharpstandard

Section 23.7: "address equal to zero" is not defined

Open
#197 4 comments 0 reactions 0 assignees View on GitHub
type: clarity
Dominant language
C#
Stars
815
Forks
99
Avg merge
1d 14h
Merged PRs (30d)
16

Description

https://github.com/ECMA-TC49-TG2/conversion-to-markdown/commit/723fd656719477260319b0394281bf760ca8ca08 constrains the behavior of the `fixed` statement when the array expression is `null`, or the array has zero elements. The C# 5 standard states:

> The behavior of the `fixed` statement is implementation-defined if the array expression is `null` or if the array has zero elements.

The change states:

> If the array expression is `null` or if the array has zero elements, the initializer computes an address equal to zero.

When we reviewed this, those present agreed that "an address equal to zero" was not defined well. We want to keep the change in principle. It was added to support optimizations in the runtime. However, we think the language may need to change.

The original change was made in dotnet/csharplang#16

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.