Define 64-bit contants in Visual Studio C++

Posted on 2011-10-20
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?

Question by:thevinenator
    LVL 16

    Accepted Solution

    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;
    LVL 43

    Expert Comment

    long long ll = 23;  //ll is a 64 bit data which currently is 23

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
    A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
    The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
    The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

    754 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now