Skip to content

Style Guide Enum Bool Thoughts #21684

@JeremyRubin

Description

@JeremyRubin

In many places we use bool parameters to denote some effect.

I suggest that throughout the codebase, we make an effort to (where feasible/touched) replace these with enum class.

It's a bit more verbose, but it's already a norm to do f(/* confusing bool */ true), and it would be nice if our compiler helped us out.

Further, it makes it easier should later code extend the functionality to add more/different options.

In order to reduce clutter we could make a macro BoolEnum(Argument, EnabledName, DisabledName)

Not high importance, so I don't think we should make a project out of it, but I was looking at some code recently where it would have been nice.

Con: we don't need more structs.

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