apache / apache/arrow

[C++] uint8_t is not guaranteed to be a valid byte alias

Open
#36,123 2 comments 0 reactions 0 assignees View on GitHub
Component: C++ Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the bug, including details regarding any error messages, version, and platform.

The standard states that accessing bytes of an object through a type other than `char`, `unsigned char`, or `std::byte` is undefined behavior. However in arrow we mostly use `uint8_t` when examining bytes. It'd be more correct to replace such occurrences with `std::byte`, and will guard against future surprises if (for example) a new optimization pass leverages this strict aliasing rule in a way that will break our code.

### Component(s)

C++

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.