C++ Logo


Advanced search

Subject: Re: Constant initialization in C++20
From: chuck.allison (chuck.allison_at_[hidden])
Date: 2019-06-18 11:07:31

Well said, Tomas. I think const is sufficient in most instances for newcomers, with constexpr presented as needed. Going beyond this can be overwhelming and contribute to the belief that C++ is an experts-only language. Concepts should presented when they can be understood. Much of C++ exists to support implementers of systems and libraries. Such people are not newcomers to programming, and usually not newcomers to C++.ChuckSent from my Samsung Galaxy smartphone.
-------- Original message --------From: Tomas p via SG20 <sg20_at_[hidden]> Date: 6/18/19 12:47 AM (GMT-07:00) To: sg20_at_[hidden] Cc: Tomas p <pecholt_at_[hidden]> Subject: [SG20] Constant initialization in C++20 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