Size of Integer , long Integer, Long double

Discussion in 'C++' started by Suresh V, Jul 4, 2010.

  1. Suresh V

    Suresh V Guest

    I did a small analysis of getting size of each of these data types

    Types 16-bit 32-bit 64-bit
    int 2 4 4
    long int 4 4 8
    long double 10 12 16

    Numbers are in bytes.

    how the size of an integer is decided?

    Is it based on processor or compiler or OS? If so why can't it be
    constant across all platforms

    Please clear my doubt.

    +suresh
     
    Suresh V, Jul 4, 2010
    #1
    1. Advertisements

  2. Suresh V

    Ian Collins Guest

    Generally by the OS (based on the CPU type). A decent (if biased)
    overview of common memory models can be found here:

    http://www.unix.org/version2/whatsnew/lp64_wp.html
    We live in an imperfect world!
    Which is?
     
    Ian Collins, Jul 4, 2010
    #2
    1. Advertisements

  3. Suresh V

    Suresh V Guest

    You have cleared my doubt partially!
    We live in an imperfect world!
    Which is?

    I will take a look at your link.

    Thanks,
    Suresh
     
    Suresh V, Jul 4, 2010
    #3
  4. Completely off-topic, but I'm curious to know why you assume that
    everybody is using the exact same variable-width font as you are.

    (Generally speaking, if you want to use any kind of formatting in usenet
    news, the only safe assumption you can make is to use a fixed-width font.)
     
    Juha Nieminen, Jul 4, 2010
    #4
  5. Suresh V

    Suresh V Guest

    I don't see any way to create table in usenet so used my own variable-
    width font.
     
    Suresh V, Jul 4, 2010
    #5
  6. Suresh V

    SaticCaster Guest

    SaticCaster, Jul 5, 2010
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.