dotnet / dotnet/dotnet-api-docs

Confusing sentence in documentation of System.Runtime.CompilerServices.Unsafe.ReadUnaligned

Open
#5,342 3 comments 1 reaction 0 assignees View on GitHub
area-System.Runtime.CompilerServices Pri3 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

[The documentation](https://docs.microsoft.com/dotnet/api/system.runtime.compilerservices.unsafe.readunaligned?view=netcore-3.1) says that

> Reads a value of type T from the given location without assuming architecture dependent alignment of the addresses.

What means "without assuming architecture dependent alignment of the addresses" ?
This sentence is really confusing.
When the first time I see this documentation, I thought that
"If we forget to assuming architecture dependent alignment of the addresses while read or write from unaligned addresses, we will fail it. So, this method requires alignment."
IMHO,
"Reads a value of type T correctly from given location even if while we use the platform which requires alignment and given location is unaligned."
is better sentence.

`Unsafe.WriteUnaligned` also has same problem.

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.