No, what you have shown should NOT compile. See Explicit type conversions on cppreference.com for details.
In a function-style cast, spaces are not allowed in the type name. For such types, you would need to use a C-style or C++-style cast instead, eg:
std::cout << ((unsigned long long)10);
or
std::cout << static_cast<unsigned long long>(10);
Otherwise, use a type alias instead, eg:
using ull = unsigned long long; // C++11 and later
or
typedef unsigned long long ull; // pre-C++11
std::cout << ull(10);
Note, the <cstdint>
header may have a uint64_t
type you can use, eg:
#include <cstdint>
std::cout << uint64_t(10);
or
std::cout << ((uint64_t)10);
or
std::cout << static_cast<uint64_t>(10);
That being said, for integer literals, you can alternatively use the ULL
suffix (C++11 and later), eg:
std::cout << 10ULL;