Skip to content

Support a relaxed casting mode #4148

@cyanreg

Description

@cyanreg

Currently, if you want to set any limited-precision number in any situation, you have to cast.

    uint16_t val = uint16_t(0);
    const uint16_t arr[4] = { uint16_t(0), uint16_t(0), uint16_t(0), uint16_t(0) };

This leads to code interacting with mixed-precision numbers requiring casts in every single line, such as throughout this entire file.

Everything here was designed to not overflow. Generally programmers know whether something will overflow or not.
Having a #pragma releaxed_casting would be a good quality of life improvement.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions