C++ Logo

SG20

Advanced search

Subject: "constinit" seems to be very confusing
From: Nicolai Josuttis (nico_at_[hidden])
Date: 2020-11-22 09:07:23


Starting to learn and document C++20, I just realized that
the keyword "constinit" seems very confusing.
Every naive programmer would assume it means "init a const",
but it seems the const is simply wrong; it is the opposite.
Or as Jonathan Müller wrote in a talk:
  constinit = constexpr - const

Now I wonder how to teach that.
Could somebody elaborate please why we have chosen this name
and what is the best way to make this name plausible to ordinary
programmers?

Thanks
  Nico

-- 
Nicolai M. Josuttis
www.josuttis.de

SG20 list run by sg20-owner@lists.isocpp.org

Older Archives on Google Groups