Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Size of Integer , long Integer, Long double

Reply
Thread Tools

Size of Integer , long Integer, Long double

 
 
Suresh V
Guest
Posts: n/a
 
      07-04-2010
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
 
Reply With Quote
 
 
 
 
Ian Collins
Guest
Posts: n/a
 
      07-04-2010
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
 
Reply With Quote
 
 
 
 
Suresh V
Guest
Posts: n/a
 
      07-04-2010
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


 
Reply With Quote
 
Juha Nieminen
Guest
Posts: n/a
 
      07-04-2010
Suresh V <(E-Mail Removed)> 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.)
 
Reply With Quote
 
Suresh V
Guest
Posts: n/a
 
      07-04-2010
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 <(E-Mail Removed)> wrote:
> Suresh V <(E-Mail Removed)> 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.)


 
Reply With Quote
 
SaticCaster
Guest
Posts: n/a
 
      07-05-2010
See Data model - http://www.viva64.com/terminology/Data_model.html
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
unsigned long long int to long double Daniel Rudy C Programming 5 09-20-2005 02:37 AM
cannot convert parameter from 'double (double)' to 'double (__cdecl *)(double)' error Sydex C++ 12 02-17-2005 06:30 PM
Help: Double convert to Integer and Double.... da Vinci C++ 5 07-31-2004 12:35 AM
Re: long long integer and double precision number cyberdude C Programming 2 06-25-2003 07:54 PM
Re: long long integer and double precision number Dan Pop C Programming 0 06-24-2003 12:11 PM



Advertisments