ISO/IEC JTC1 SC22 WG21 P1182R0
Gennaro Prota <gennaro.prota@gmail.com>
Target audience: LEWG
2018-09-13

New names for the power-of-2 templates (and their header)

Motivation

This short paper is a request to amend the changes incorporated in the working paper after the acceptance of P0556: Integral power-of-2 operations, which proposed adding some template functions, and a new header, for some operations related to powers of two. Specifically, this asks to change the names of the facilities and the name of the corresponding header. At the time of writing, the header name is <bit> and the facilities have the following names: We believe that these names are too cryptic. Note that names in the C++ library proper (as opposed to the C library) don't generally use abbreviations. The issue here is which convention to follow: it can be argued that we already have std::ceil, std::floor, std::pow; but these names come from C. One can imagine two policies: use the new convention (snake case with no abbreviations) on all new names (which we prefer) or use a convention close to C if the facilities do something close to some C facility, or involve names already used in C (the policy that seems to have been used for the facilities discussed here; we don't like this). It should be discussed, anyway, whether using a literal "2" in the names, in lieu of the word "two", is OK (spelled out names may become too large: thing e.g. of "two_hundred_fifty_six"; on the other hand, a "1" may look too similar to a lowercase ell with some fonts). This paper provisionally proposes the name <power_of_2> for the header, and the following names for the templates: This paper does not propose any semantic change. It also proposes no changes to bit_cast.

References