Skip to content

feat: ✨ Make controller ctor constexpr - #685

Open
ion098 wants to merge 1 commit into
purduesigbots:develop-pros-4from
ion098:feature/constexpr-controller-ctor
Open

ion098 wants to merge 1 commit into
purduesigbots:develop-pros-4from
ion098:feature/constexpr-controller-ctor

Conversation

@ion098

@ion098 ion098 commented Jul 5, 2024

Copy link
Copy Markdown
Contributor

Summary:

Changes the pros::Controller constructor to be constexpr.

Motivation:

Allows pros::Controller instances to be declared constinit/constexpr.

Test Plan:

  • Check it compiles
  • Check that Controller instances can be declared as constinit/constexpr.

@BennyBot

BennyBot commented Jul 5, 2024

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@djava

djava commented Jul 7, 2024

Copy link
Copy Markdown
Contributor

While you're doing this, what other ctors should this be applied to? I imagine this isn't the only one.

@ion098

ion098 commented Jul 8, 2024

Copy link
Copy Markdown
Contributor Author

While you're doing this, what other ctors should this be applied to? I imagine this isn't the only one.

The issue is that some device ctors can't be made constexpr becuase they touch global state (changing this would require a breaking change to the PROS API which I don't think is gonna happen now), it feels a bit weird to have some devices with constexpr ctors and others without.

@ion098 ion098 changed the title ✨ Make controller ctor constexpr feat: ✨ Make controller ctor constexpr Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants