Question

I am now studying about writing binary files. I've seen this question on StackOverflow. And the author says, in his code

const unsigned long long size = 1ULL*1024ULL*1024ULL;

I don't actually know what are the ULL symbols. Could anybody give me some documentation about it? I have searched on Google, and everything I get is more documentation about writing files...

Was it helpful?

Solution

It is a suffix that specifies the type of literal (in this case, integer literals).

You can find out more about this in the C++ standard, specifically in 2.14 - Literals

In your case, the answer lies in the following table (from this very part of the standard) : unsigned long long.

Integer literals suffixes

OTHER TIPS

It makes 1 and 1024 be unsigned long long constants or else they'd default to int (in terms of how many bytes the value will take to be represented):

std::cout << sizeof(1ULL) << sizeof(1);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top