?
Solved

Define 64-bit contants in Visual Studio C++

Posted on 2011-10-20
2
Medium Priority
?
388 Views
Last Modified: 2012-05-12
i am attempting to port a Linux app to Visual Studio.

The code has references to 64 bit data types...

"unsigned long long" and "long long"

hex constants that are used with these data types end with LL or ULL, such as 0x00ULL

Visual Studio (express) chokes on these constants. The compiler doesn't like the LL or ULL on the ends of the hex strings but the variable declarations is doesn't complain about.

is there an include file that is need to support these constants? is there a preferred way to implement them?

0
Comment
Question by:thevinenator
2 Comments
 
LVL 16

Accepted Solution

by:
HooKooDooKu earned 2000 total points
ID: 37003204
From what I can see, you don't need to specify the data size with a literal constant.  If the constant is smaller than what it needs to go into, the compiler will make it bigger as needed.  If the constant is bigger than a long, you don't have to do anything special.

For example, the following code compiles on my Visual Studio C++ just fine:
      __int64 n;
      n = 0x1234123412341234;
      n = 0x1;
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 37005011
long long ll = 23;  //ll is a 64 bit data which currently is 23
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question