C++ Logo

SG20

Advanced search

Subject: Constant initialization in C++20
From: Tomas p (pecholt_at_[hidden])
Date: 2019-06-18 01:47:29


Hi,

this post is inspired by a presentation of one committee member posted
recently on reddit.
https://www.reddit.com/r/cpp/comments/c06908/cnow_2019_daveed_vandevoorde_c_constants/

I have no doubts there is a lot of good thoughts and engineering behind the
works. But this group should discuss suitability for teaching or
approaching students and other c++ programmers. I would say discussing new
proposals from teach-ability perspective should be one of the most
important things for this group. It's arguably more important than new
guidelines and material - that can be done any time and people do it
already - but once a new complicated or difficult to teach feature is
included in the standard there is no way to remove it and so we should
better get it right.

So I have a question. Do you really think constant
variables/functions/initialization is going in the right direction? Most
c++ programmers I know are using only pre-c++11 const keyword. Few
understand constexpr variables and functions. How many of them do you think
will be using new keywords in this area - consteval, constinit,
is_constant_evaluated when it becomes available? Doesn't this work solve
niche problem? Do you think so many new keywords for constant
initialization will not be a burden to newcomers and average c++
programmers?

I am really interested in what this group thinks of it.



SG20 list run by herb.sutter at gmail.com

Older Archives on Google Groups