number of bytes for a type in C++



 DEVELOP > c-Plus-Plus > number of bytes for a type in C++

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: ""
Date: 10 Dec 2004 10:48:53 AM
Object: number of bytes for a type in C++
In C++, the amount of memory used to store int is 4 bytes, or dependent
upon the hardware?
I think still dependent on the machine, since C++ compiler is platform
dependent.
Please advise. Thanks
.

User: "Keith Thompson"

Title: Re: number of bytes for a type in C++ 10 Dec 2004 02:42:55 PM
writes:

In C++, the amount of memory used to store int is 4 bytes, or dependent
upon the hardware?
I think still dependent on the machine, since C++ compiler is platform
dependent.

In C, it's dependent on the implementation, with some specific
constraints imposed by the standard.
But since your question is about C++, cross-posting it to comp.lang.c
was a bad idea.
Followups redirected.
--
Keith Thompson (The_Other_Keith)
<http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.
User: "Rolf Magnus"

Title: Re: number of bytes for a type in C++ 10 Dec 2004 02:55:09 PM
Keith Thompson wrote:

jrefactors@hotmail.com writes:

In C++, the amount of memory used to store int is 4 bytes, or dependent
upon the hardware?
I think still dependent on the machine, since C++ compiler is platform
dependent.


In C, it's dependent on the implementation, with some specific
constraints imposed by the standard.

The same is true for C++. The rules regarding integer type sizes are the
same in C++ as in C, with the exception that C++ doesn't know the "long
long" type.
.


User: "Victor Bazarov"

Title: Re: number of bytes for a type in C++ 10 Dec 2004 10:59:47 AM
wrote:

In C++, the amount of memory used to store int is 4 bytes, or dependent
upon the hardware?
I think still dependent on the machine, since C++ compiler is platform
dependent.

You think right.
.

User: "JH Trauntvein"

Title: Re: number of bytes for a type in C++ 10 Dec 2004 10:59:21 AM
I believe that the standard guarantees minimum ranges for intrinsic
types. For example, I believe that the minimum range for type int is
[-32768, +32767].
Regards,
Jon Trauntvein
.

User: ""

Title: Re: number of bytes for a type in C++ 10 Dec 2004 11:07:28 AM
It is depending upon the hardware.
According to TCPPPL,
this is what guaranteed about the sizes of fundamental types
1 = sizeof(char) <= sizeof(short) <= sizeof(int) <=sizeof(long)
1<= sizeof(bool) <= sizeof(long)
sizeof(char) <=sizeof(wchar_t) <= sizeof(long)
sizeof(float) <= sizeof(double) <= sizeof(long double)
sizeof(N) = sizeof(signed N) = sizeof(unsigned N)
.
User: "Mark McIntyre"

Title: Re: number of bytes for a type in C++ 10 Dec 2004 11:51:18 AM
On 10 Dec 2004 09:07:28 -0800, in comp.lang.c ,

wrote:

It is depending upon the hardware.

And the compiler. Think about old DOS compilers.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
.



  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER