C++11 5.3.3.6 and C++14 5.3.3.6 both state the following:
The result of sizeof and sizeof... is a constant of type std::size_t.
[ Note: std::size_t is defined in the standard header <cstddef> (18.2). —end note ]
I (probably mistakenly) interpret this to mean that if there were a way to display the data type of a sizeof expression (maybe there is?) it should display "std::size_t" or "size_t" rather than "unsigned int", "unsigned long" or whatever size_t happens to represent on that particular compiler, and it should display "std::size_t" or "size_t" even if there were no typedef of size_t in scope because the compiler internally knows it is size_t.
However, if my interpretation is incorrect and it would instead be correct for the underlying data type to be displayed, shouldn't C++11 and C++14 instead say something like:
The result of sizeof and sizeof... is a constant of **the same type represented** by std::size_t.
I realize this may be just a technicality that I'm missing but I would still like to understand it.
Thanks, Ray
Aucun commentaire:
Enregistrer un commentaire