#StackBounty: #c++ Tools to automatically modernize code with constexpr

Bounty: 50

I work on a large codebase that is migrating to C++14 (and eventually C++17 & beyond). We’d like to “constexpr all the things,” but obviously with a large codebase, our team can’t go in overnight and annotate the thousands of functions and variable declarations that really should be constexpr.

Is there a tool out there that can parse our code, figure out what could be constexpr, and automatically make the changes? I imagine this would require some human review… but any help we could get from tools would be a win.

I’d be thrilled with even partial solutions—e.g., turn all #defines of numeric constants into typed constant expressions.

(Note that my question is not why constexpr is not applied automatically by the compiler… instead, my goal is to modify the code to add constexpr wherever we can.)

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.