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. Advertising

  2. Suresh V

    Ian Collins Guest

    On 07/ 4/10 10:09 PM, Suresh V wrote:
    > 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?


    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

    > If so why can't it be constant across all platforms


    We live in an imperfect world!

    > Please clear my doubt.


    Which is?

    --
    Ian Collins
     
    Ian Collins, Jul 4, 2010
    #2
    1. Advertising

  3. Suresh V

    Suresh V Guest

    You have cleared my doubt partially!

    > If so why can't it be constant across all platforms


    We live in an imperfect world!

    >>>> :(


    > Please clear my doubt.


    Which is?

    >>>> The question that i mentioned above are my doubts.


    I will take a look at your link.

    Thanks,
    Suresh
     
    Suresh V, Jul 4, 2010
    #3
  4. Suresh V <> wrote:
    > Types 16-bit 32-bit 64-bit
    > int 2 4 4
    > long int 4 4 8
    > long double 10 12 16


    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.

    On Jul 4, 4:55 pm, Juha Nieminen <> wrote:
    > Suresh V <> wrote:
    > > Types               16-bit     32-bit     64-bit
    > > int                       2          4            4
    > > long int                4          4            8
    > > long double          10        12           16

    >
    >   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.)
     
    Suresh V, Jul 4, 2010
    #5
  6. Suresh V

    SaticCaster Guest

    SaticCaster, Jul 5, 2010
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. da Vinci
    Replies:
    5
    Views:
    8,758
    da Vinci
    Jul 31, 2004
  2. Sydex
    Replies:
    12
    Views:
    6,601
    Victor Bazarov
    Feb 17, 2005
  3. Dan Pop
    Replies:
    0
    Views:
    1,201
    Dan Pop
    Jun 24, 2003
  4. cyberdude
    Replies:
    2
    Views:
    5,154
    Keith Thompson
    Jun 25, 2003
  5. Daniel Rudy

    unsigned long long int to long double

    Daniel Rudy, Sep 19, 2005, in forum: C Programming
    Replies:
    5
    Views:
    1,235
    Peter Shaggy Haywood
    Sep 20, 2005
Loading...

Share This Page