4 ms·
uint64_t is a typedef defined in stdint.h. std::uint64_t is defined in the std namespace in <cstdint>
by nly 12y ago
uint64_t is a typedef defined in stdint.h. std::uint64_t is defined in the std namespace in <cstdint>
- leetNightshade 12y agoYes, though which do you propose should be used? It's nice that the type is wrapped in the std namespace, but for something like a basic standardized type, seems like a waste. I think I'd rather include stdint.h.
- verroq 12y agoYou're writing C++ code, no need to regress back to C.
- shmerl 12y agoYes, but I agree with the commenter above. Wrapping it in std seems weird. By your logic, one shouldn't use int and long too, or may be they should be wrapped in std?
- jevinskie 12y agoIf it bothers you so much, just use 'using namespace std;' or 'using std::uint64_t;'. http://en.cppreference.com/w/cpp/language/namespace http://en.cppreference.com/w/cpp/language/namespace Or just '#include <stdint.h>'. C++ is TIMTOWTDI too!
- leetNightshade 12y agoYes, thank you (TIMTOWTDI)! I was just curious to see what other's used, and was sad to see this comment: "You're writing C++ code, no need to regress back to C." Really? Sure it's from C, but it's a part of C++. Going the route `using std::uint64_t`, you'd have to do that for every basic type. Which is fine. I'd just use that in a general header that's included everywhere in a project (stdafx, or what have you). Though at that point it doesn't really matter which you pick.
- shmerl 12y agoI'd prefer them to be included in C++ as regular base types really, to be on equal terms with int, char and etc.
- nly 12y agoIt's extremely useful for argument-dependant lookup[0]. If a and b are "uint64_t" and not "std::uint64_t" then "swap(a,b)" won't work in a generic fashion. http://en.wikipedia.org/wiki/Argument-dependent_name_lookup http://en.wikipedia.org/wiki/Argument-dependent_name_lookup