The names of the smart pointer types std::unique_ptr
and std::shared_ptr
contain an underscore (_), whereas the keyword nullptr
doesn't. So I'm curious: What, if any, is the rationale for using or not using an underscore in the keyword nullptr
?
Note: I know nullptr
is a keyword serving as null pointer constant, of type nullptr_t
, whereas std::unique_ptr
is a type. So maybe the rationale is related to keywords not having underscores whereas types often do. Seems a little thin, but maybe. Or perhaps the rationale is related to use of null_ptr versus nullptr in heritage code?
Edit: nullptr
became a keyword as of C++11.
Edit (from comment by R2-Dequeue): From Table 3 in 2.11 in the standard, C++14 keywords with underscores:
const_cast
,dynamic_cast
,reinterpret_cast
,static_cast
static_assert
char16_t
,char32_t
,wchar_t
thread_local
And for completeness, also the alternative representations from Table 4:
and_eq
,or_eq
,xor_eq
,not_eq