473,322 Members | 1,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

size of an integer ??


what does the size of an integer depend on ?? is it the Operating
system, processor or the associated memory in the system ??

--
Shalini
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Nov 14 '05 #1
7 1540

"Shalini" <Sh************@mail.codecomments.com> wrote in message
news:Sh************@mail.codecomments.com...

what does the size of an integer depend on ?? is it the Operating
system, processor or the associated memory in the system ??

Well primarily the size of the integer depends upon the processor itself
only. However processors do indeed have support for backward compatibility,
so you can see you code compiled by Turbo C++ 3.0 and other esoteric
compilers which have 16 bit integers execute quite easily on 32 bit
platforms and for that matter also on 64 bit platforms.


--
Imanpreet Singh Arora
If I would have only known, I would have been a locksmith.
-- Albert Einstein

Nov 14 '05 #2
Shalini wrote:

what does the size of an integer depend on ??
is it the Operating
system, processor or the associated memory in the system ??


I had a 16 bit compiler and a 32 bit compiler on the same machine.

--
pete
Nov 14 '05 #3
The size of an integer is dependent on the whim of the author of the
compiler you use. While the CPU may have a notion of an "integer", the
compiler is not obliged to use it. You could have 43-byte integers on
hardware that used 32-bit arithematic and all it would mean is the compiler
writer did some tricky stuff behind the scenes to implement 43-byte ints.

Shalini wrote:

what does the size of an integer depend on ?? is it the Operating
system, processor or the associated memory in the system ??

--
Shalini
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------


--
remove .nospam from e-mail address to reply
Nov 14 '05 #4
Shalini <Sh************@mail.codecomments.com> writes:
what does the size of an integer depend on ?? is it the Operating
system, processor or the associated memory in the system ??


It depends on the judgement of the implementer of the compiler,
subject to the restrictions in the standard. That judgement in turn
typically depends on the nature of the underlying system (int is very
often, but not always, the size of a CPU data register; sizes of other
integer types can depend on what the hardware conveniently supports).
Compatibility with other systems can also be a consideration; a
compiler for a "32-bit" system might have 16-bit int for compatibility
with older "16-bit" versions of the system. (I put "16-bit" and
"32-bit" in quotation marks because there's no universal agreement on
what those terms mean.)

--
Keith Thompson (The_Other_Keith) ks***@mib.org <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.
Nov 14 '05 #5


Please don't top-post.


--
Imanpreet Singh Arora
If I would have only known, I would have been a locksmith.
-- Albert Einstein


"James McIninch" <ja*******************@comcast.net> wrote in message
news:RqwXc.51671$9d6.18296@attbi_s54...
The size of an integer is dependent on the whim of the author of the
compiler you use. While the CPU may have a notion of an "integer", the
compiler is not obliged to use it. You could have 43-byte integers on
hardware that used 32-bit arithematic and all it would mean is the compiler writer did some tricky stuff behind the scenes to implement 43-byte ints.

Shalini wrote:

what does the size of an integer depend on ?? is it the Operating
system, processor or the associated memory in the system ??

--
Shalini
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------


--
remove .nospam from e-mail address to reply

Nov 14 '05 #6
Minti <mi************@yahoo.com> scribbled the following:
Please don't top-post.
Very funny.
--
Imanpreet Singh Arora
If I would have only known, I would have been a locksmith.
-- Albert Einstein
"James McIninch" <ja*******************@comcast.net> wrote in message
news:RqwXc.51671$9d6.18296@attbi_s54...


(snip)

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"As a boy, I often dreamed of being a baseball, but now we must go forward, not
backward, upward, not forward, and always whirling, whirling towards freedom!"
- Kang
Nov 14 '05 #7
> what does the size of an integer depend on ?? is it the Operating
system, processor or the associated memory in the system ??


The compiler only. And even then it does not have to be fixed. For
example, in an earlier version of Metrowerks CodeWarrior C/C++, the
size of an int was a compiler preference setting.

Jonathan Hoyle
Nov 14 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Shailesh | last post by:
One problem I've been wrestling with for a long time is how to use the C++ integral data types, vis-a-vis their size. The C++ rules guarantee that a char is at least 1 bytes, a short and int at...
5
by: Brian DSouza | last post by:
I got the following code from an earlier posting (much earlier, like 1999) in this ng. This is supposed to control the paper size selected to legal, even if the default printer changes. Question is...
33
by: siliconwafer | last post by:
What is size of pointer in C on DOS? is it sizeof(int ) or size of (long int)? If this ans is present in FAQ pls direct me to tht ouestion
4
by: tshad | last post by:
I am having trouble with links in my DataGrid. I have Links all over my page set to smaller and they are consistant all over the page in both Mozilla and IE, except for the DataGrid. Here is a...
4
by: Shayne H | last post by:
How can I create a structure that gets passed to an API call that will automatically set its size field? I tried the following: <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _...
5
by: Francois Soucy | last post by:
Hi all! I've created a personal control. This control is mainly a panel with some other stuff in. I want to know if it's possible to know the size of the container of this control? I mean that my...
12
by: J L | last post by:
When I fill a listview, I resize the columns to fit the data. I need to know if the data will fit vertically or if there will be a vertical scroll bar. I need to know this so I can allow for it on...
6
by: marktxx | last post by:
Although the C90 standard only mentions the use of 'signed int' and 'unsigned int' for bit-fields (use 'int' at your own risk) and C99 adds _Bool. It seems that most compilers create the size of...
36
by: James Harris | last post by:
Initial issue: read in an arbitrary-length piece of text. Perceived issue: handle variable-length data The code below is a suggestion for implementing a variable length buffer that could be used...
6
by: Miro | last post by:
Is there a way to / or a mathematical formula to see if a font size is 'too big' for a label. I have a label that is docked to 'fill' a form, and I want to resize that font based on the width...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.