Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6166153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:17:25+00:00 2026-05-23T22:17:25+00:00

We obviously can’t make everything constexpr . And if we don’t make anything constexpr

  • 0

We obviously can’t make everything constexpr. And if we don’t make anything constexpr, well, there won’t be any big problems. Lots of code have been written without it so far.

But is it a good idea to slap constexpr in anything that can possibly have it? Is there any potential problem with this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:17:26+00:00Added an answer on May 23, 2026 at 10:17 pm

    It won’t bother the compiler. The compiler will (or should anyway) give you a diagnostic when/if you use it on code that doesn’t fit the requirements of a constexpr.

    At the same time, I’d be a bit hesitant to just slap it on there because you could. Even though it doesn’t/won’t bother the compiler, your primary audience is other people reading the code. At least IMO, you should use constexpr to convey a fairly specific meaning to them, and just slapping it on other expressions because you can will be misleading. I think it would be fair for a reader to wonder what was going on with a function that’s marked as a constexpr, but only used as a normal run-time function.

    At the same time, if you have a function that you honestly expect to use at compile time, and you just haven’t used it that way yet, marking it as constexpr might make considerably more sense.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Obviously I can do and DateTime.Now.After - DateTime.Now.Before but there must be something more
Obviously I can use BCP but here is the issue. If one of the
You can, obviously, put a variable declaration in a for loop: for (int i
It seems like such a simple thing, but I can't find any obvious solutions...
Obviously there are security reasons to close a wireless network and it's not fun
is there any way in MVC to get the System.Net.Mail SendAsync to work, instead
jQuery can obviously fadeIn/fadeOut text easily. But what if you want to change the
When using WPF databinding, I obviously can't do something along the lines of MyCollection
Is there a way that I can remove links in posts via my functions.php
The code bellow does not work, obviously objects can't be saved to variables in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.