Code:sprintf(val, "%llu", (long long)top << 32 | bottom);
Code:sprintf(val, "%llu", (long long)top << 32 | bottom);
A type cast does not allocate memory for any type of variable.Originally Posted by nonoob
Learn C++ (C++ Books, C Books, FAQ, Forum Search)
Code painter latest version on sourceforge DOWNLOAD NOW!
Download FSB Data Integrity Tester.
Siavosh K C
I didn't mean that (dynamic allocation). Stack memory is also allocated.What type of variable, do you think, will be put on the stack?
Learn C++ (C++ Books, C Books, FAQ, Forum Search)
Code painter latest version on sourceforge DOWNLOAD NOW!
Download FSB Data Integrity Tester.
Siavosh K C
Sorry, I think I was wrong.Originally Posted by nonoob
Are you sure it will work with any compiler?
Learn C++ (C++ Books, C Books, FAQ, Forum Search)
Code painter latest version on sourceforge DOWNLOAD NOW!
Download FSB Data Integrity Tester.
Siavosh K C
Still not sure about what the concern is. If the compiler supports 64-bit integers, then it is allowable to push such a data type on the stack. sprintf's "%lld" will retrieve that sized value properly.
I expected more of an objection about neglecting to cast bottom as well. I figured the compiler promotes its type automatically to match the largest type so far - the one to the left of the binary 'or' operator. Else I would have seen a warning about incompatible types.