Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7824173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:30:34+00:00 2026-06-02T08:30:34+00:00

So I was doing some testing with the new data type long long when

  • 0

So I was doing some testing with the new data type long long when I stumbled upon a little “problem” (example came from C++ Primer 6th edition). I was using the climits library to tell me the maximum number supported by long and long long and both came out to 9223372036854775807. How is that possible?

#include <iostream> 
#include <climits>

int main()
{
    std::cout << "int size is " << sizeof(int) << " bytes." << std::endl;
    std::cout << "short size is " << sizeof(short) << " bytes." << std::endl;
    std::cout << "long size is " << sizeof(long) << " bytes." << std::endl;
    std::cout << "long long size is " << sizeof(long long) << " bytes." << std::endl;

    std::cout << "Maximum values: " << std::endl;
    std::cout << "int: " << INT_MAX << std::endl;
    std::cout << "short: " << SHRT_MAX << std::endl;
    std::cout << "long: " << LONG_MAX << std::endl;
    std::cout << "long long: " << LLONG_MAX << std::endl;

    return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T08:30:36+00:00Added an answer on June 2, 2026 at 8:30 am

    The C99 standard specifies ranges of values each type must be able to represent (§5.2.4.2.1). The specified values are minimum magnitude, so nothing prevent from having bigger range. I converted this value to the least number of bits needed to represent number in these ranges on a digital computer.

    • int should be at least 16 bits (range from –32,768 to 32,767)
    • long should be at least 32 bits (range from –2,147,483,648 to 2,147,483,647)
    • long long should be at least 64 bits (range from –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are doing some empirical testing of Java data structures and have got some
I am doing some testing for a very large website, created many different developers.
I am doing some initial testing for a Rails app which will be deployed
I'm doing some unit testing, and some of the code is checking to see
I am doing some performance testing and have found that SQL seems to be
I'm in the process of doing some advance IE8 testing, and it seems that
I've just started doing some real-world performance testing on my Fluent NHibernate / SQLite
While doing some JavaScript performance tests I came up with the following piece of
I've been doing some research and testing on how to do fast random selection
I need to replace some data that's sent from every page on my site,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.