Skip to content

[SUGGESTION] Compiletime / runtime separation or constexpr, consteval, template<> sickness. #374

Closed

Description

@fro0m

Just to share my idea of constexpr.
C++ has a strict separation between runtime and compiletime. All about compiletime was assisted with <> characters syntax before constexpr.
And I have no idea why constexpr was introduced. It was easier to embrace <expression> with <> to specify that it is strict compile time.
<i>: int defines compile time variable,
i.e. translates to constexpr int i

if <args.cout> == 3 {
        p = a&;
    }

Forces <expression> to be compile-time, i.e. translates to

if constexpr (args.cout == 3) {
       p = a&;
   }

Activity

  1. changed the title [-][SUGGESTION] constexpr consteval template<> sickness and compiletime / runtime separation.[/-] [+][SUGGESTION] Compiletime / runtime separation or constexpr, consteval, template<> sickness.[/+] on May 6, 2023
  2. AbhinavK00 commented on May 14, 2023

    @AbhinavK00

    I don't think we need to mark all compile time things with <>,the <> was probably chosen with generics in mind, it just happened that all generic related work was done at compile time due to zero overhead principle

  3. jcanizales commented on May 17, 2023

    @jcanizales

    I'm a fan of the unified const {...} proposal of #255

  4. Repository owner locked and limited conversation to collaborators on Aug 30, 2023
  5. converted this issue into a discussion #644 on Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions